Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
各レイヤーからのエラーについて考える
Search
yoshiyoshifujii
October 21, 2017
Programming
3
3.5k
各レイヤーからのエラーについて考える
関西Javaエンジニアの会(関ジャバ) '17 10月度
https://kanjava.connpass.com/event/68169/
yoshiyoshifujii
October 21, 2017
Tweet
Share
More Decks by yoshiyoshifujii
See All by yoshiyoshifujii
プロダクトオーナーの視座から見た信頼性とオブザーバビリティ / Reliability and Observability from the Perspective of a Product Owner
yoshiyoshifujii
1
1.5k
プロダクトオーナーがFour Keys + 信頼性に思うところ / Product Owners Think of Four Keys + Reliability
yoshiyoshifujii
0
510
Recapping Chatwork Scala Journey - ScalaMatsuri2023
yoshiyoshifujii
0
2.7k
ここ数ヶ月でAkkaを勉強した方法について紹介 / I have studied Akka in the past few months
yoshiyoshifujii
1
270
コードをどまんなかに据えたモデリング-Scala版 / Modeling with code in the middle-Scala version
yoshiyoshifujii
0
130
Chatworkのドメインをモデリングした / Modeling Chatwork domain
yoshiyoshifujii
0
850
サマーインターンシップ2019で学生とDDDなScala開発に取り組んだ / Working on DDD and Scala development with students at Summer Internship 2019
yoshiyoshifujii
2
4.1k
Clean Architecture in Practice @ScalaMatsuri2019
yoshiyoshifujii
9
4k
実践 Clean Architecture
yoshiyoshifujii
13
10k
Other Decks in Programming
See All in Programming
PHPカンファレンス名古屋2025 タスク分解の試行錯誤〜レビュー負荷を下げるために〜
soichi
1
730
Learning Kotlin with detekt
inouehi
1
150
Jakarta EE meets AI
ivargrimstad
0
490
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
1.1k
Boos Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
470
DevNexus - Create AI Infused Java Apps with LangChain4j
kdubois
0
120
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
990
AWS Step Functions は CDK で書こう!
konokenj
4
630
Unity Android XR入門
sakutama_11
0
180
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1.2k
「個人開発マネタイズ大全」が教えてくれたこと
bani24884
1
270
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
55
19k
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
What's in a price? How to price your products and services
michaelherold
244
12k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
227
22k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
366
25k
Docker and Python
trallard
44
3.3k
Fireside Chat
paigeccino
35
3.2k
Building an army of robots
kneath
303
45k
Practical Orchestrator
shlominoach
186
10k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
650
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.6k
Designing Experiences People Love
moore
140
23k
Transcript
֤ϨΠϠʔ͔Βͷ Τϥʔʹ͍ͭͯߟ͑Δ 4BU !ZPTIJZPTIJGVKJJ
͜Μʹͪ w:PTIJUBLB'VKJJ !ZPTIJZPTIJGVKJJ w4PGUXBSF&OHJOFFS w4DBMB+BWB1ZUIPO 5ZQFTDSJQU w4DBMBؔ4VNNJU4UB⒎
ձεϙϯαʔͬͯ·͢
ି͠ग़͠Ͱ͖Δ෦ w ηϛφʔϗʔϧ ໊ w ձٞࣨ ໊͔Β໊ w
ΧϑΣεϖʔε ໊ w ϏΞόογϡͳͲͷ࠙ձ։࠵ՄೳͰ͢ʂ
ࠓͷ͓ͷલఏ w3&45"1*ͷαʔόαΠυ ը໘ؚΈ·ͤΜ w4DBMB w࣮ફͯ͠Έͨ݁ՌΛཧ w.BZFSຊಡΜͰ·ͤΜ
Τϥʔͷྨ wϢʔβʔͷૢ࡞ΛىҼͱ͢ΔΤϥʔ wγεςϜͷোΛىҼͱ͢ΔΤϥʔ
Ϣʔβʔͷૢ࡞ΛىҼͱ͢Δ wܖʹҧ͢ΔΑ͏ͳૢ࡞ wඞਢɺ͞ɺܕɺॏෳͳͲ wجຊతʹը໘ଆͰ֬ೝ͢Δ wࠓճɺ"1*Λݺͼग़͢͜ͱΛఆ wෆਖ਼ΞΫηε
γεςϜͷোΛىҼͱ͢Δ w*0ྫ֎ w/FUXPSLɺ4ZTUFN%PXO wόά w͵ΔΆ
)551εςʔλείʔυ wϢʔβʔͷૢ࡞൪ wγεςϜͷো൪
υϝΠϯۦಈઃܭ
-BZFSFE"SDIJUFDUVSF w6TFS*OUFSGBDF w"QQMJDBUJPO w%PNBJO w*OGSBTUSVDUVSF &WBOT &SJD%PNBJO%SJWFO%FTJHO5BDLMJOH$PNQMFYJUZJOUIF)FBSUPG4PGUXBSF ,JOEMFͷҐஔ/P 1FBSTPO&EVDBUJPO,JOEMF൛
ࡾ υϝΠϯϞσϧ wϓϨθϯςʔγϣϯ wΞϓϦέʔγϣϯ wσʔλιʔε wυϝΠϯϞσϧ ૿ాږݱͰཱͭγεςϜઃܭͷݪଇʙมߋΛָͰ҆શʹ͢ΔΦϒδΣΫτࢦͷ࣮ફٕ๏ ,JOEMFͷҐஔ/P גࣜձٕࣾज़ධࣾ,JOEMF൛
ΦχΦϯΞʔΩςΫνϟ wΠϯλʔϑΣʔε wΞϓϦέʔγϣϯ wυϝΠϯ wΠϯϑϥετϥΫνϟ IUUQTTQFBLFSEFDLDPNDSPTTSPBETDBMBPOEEE TMJEF
ΠϯϑϥετϥΫνϟ Πϯϑϥ αʔϏε υϝΠϯ ϨΠϠʔͰѻ͏Τϥʔ ΠϯλʔϑΣʔε ΞϓϦέʔγϣϯ ϑΝΫτϦ ΤϯςΟςΟ υϝΠϯ
αʔϏε ϦϙδτϦ ΠϕϯτύϒϦ ογϟ ϦϙδτϦ࣮ Πϕϯτ ύϒϦογϟ࣮ +BWBϥΠϒϥϦ +%#$υϥΠό ྫ֎ ϦϙδτϦ Τϥʔ ΞϓϦέʔγ ϣϯΤϥʔ υϝΠϯ Τϥʔ ࢀߟIUUQTTQFBLFSEFDLDPNDSPTTSPBETDBMBPOEEE TMJEF 5SZ\ʜ^Ͱғͬͯྫ֎Λ 5SZܕʹม 5SZ
υϝΠϯ
υϝΠϯͷΤϥʔ wܖҧ wඞਢ wܕνΣοΫ w͞ɺ͔͞ wॏෳ w%PNBJO&SSPSܕ
ϦϙδτϦυϝΠϯͱಉ͡ wυϝΠϯʹϦϙδτϦΛఆٛ͢Δ wυϝΠϯͷΤϥʔܕͱಉ͡ʹ͢Δ͔
ϦϙδτϦͷΛߟ͑Δ wυϝΠϯͷӬଓԽ w࠶ੜ w*0ྫ֎ΛΑ͘ѻ͍ͦ͏
ϦϙδτϦͰҙ֎ͱߟྀ͖͢͜ͱ wָ؍ഉଞ 0QUJNJTUJD-PDLJOH w/PU'PVOE 0QUJPOPS'BJMVSF w͜ΕΒΛܕͰද໌ͨ͘͠ͳΔ
ϑΝΫτϦυϝΠϯͱಉ͡ wϑΝΫτϦυϝΠϯΛੜ͢Δ wυϝΠϯͷੜ࣌ʹܖҧΛ֬ೝ͢ Δ wυϝΠϯͷΤϥʔͱಉ͡Ͱྑ͍
ΠϕϯτύϒϦογϟ wυϝΠϯΠϕϯτͷύϒϦογϡ wܖҧͷݕূऴΘͬͨঢ়ଶ w*0ྫ֎ͷΈΛߟྀͰྑ͍
υϝΠϯαʔϏε wυϝΠϯͷϏδωεϧʔϧΛѻ͏ wܖҧΛѻ͏ wϦϙδτϦѻΘͳ͍
υϝΠϯͷΤϥʔܕ w%PNBJO&SSPSܕ w3FQPTJUPSZ&SSPSܕ wྫ֎ TDBMBVUJM5SZ
Πϯϑϥ ετϥΫνϟ
ΠϯϑϥετϥΫνϟ Πϯϑϥ αʔϏε υϝΠϯ ϨΠϠʔͰѻ͏Τϥʔ ΠϯλʔϑΣʔε ΞϓϦέʔγϣϯ ϑΝΫτϦ ΤϯςΟςΟ υϝΠϯ
αʔϏε ϦϙδτϦ ΠϕϯτύϒϦ ογϟ ϦϙδτϦ࣮ Πϕϯτ ύϒϦογϟ࣮ +BWBϥΠϒϥϦ +%#$υϥΠό ྫ֎ ϦϙδτϦ Τϥʔ ΞϓϦέʔγ ϣϯΤϥʔ υϝΠϯ Τϥʔ ࢀߟIUUQTTQFBLFSEFDLDPNDSPTTSPBETDBMBPOEEE TMJEF 5SZ\ʜ^Ͱғͬͯྫ֎Λ 5SZܕʹม 5SZ
ϦϙδτϦ࣮ wυϝΠϯͷఆٛʹै͏ w3%#ɺ,74ɺ"84 ,JOFTJTɺ424ɺ4 w+BWB-JCSBSZ wྫ֎ΛUSZDBUDIͯ͠$POWFSU w-JCSBSZͷґଘܕด͡ࠐΊΔ
ΠϕϯτύϒϦογϟ࣮ wྫ֎Λͦͷ··ѻ͏ wಛผʹܕΛఆٛͯ͠ѻΘͳ͍
ΠϯϑϥετϥΫνϟαʔϏε wυϝΠϯͰදݱ͢Δඞཁͷͳ͍Πϯϑϥ ૢ࡞ wϑΝΠϧΞοϓϩʔυΛςϯϙϥϦʔʹ Ұ࣌อଘ w҉߸Խ෮߸
ΠϯϑϥετϥΫνϟͷΤϥʔܕ w3FQPTJUPSZ&SSPSܕ wྫ֎
ΞϓϦέʔγϣϯ
ΠϯϑϥετϥΫνϟ Πϯϑϥ αʔϏε υϝΠϯ ϨΠϠʔͰѻ͏Τϥʔ ΠϯλʔϑΣʔε ΞϓϦέʔγϣϯ ϑΝΫτϦ ΤϯςΟςΟ υϝΠϯ
αʔϏε ϦϙδτϦ ΠϕϯτύϒϦ ογϟ ϦϙδτϦ࣮ Πϕϯτ ύϒϦογϟ࣮ +BWBϥΠϒϥϦ +%#$υϥΠό ྫ֎ ϦϙδτϦ Τϥʔ ΞϓϦέʔγ ϣϯΤϥʔ υϝΠϯ Τϥʔ ࢀߟIUUQTTQFBLFSEFDLDPNDSPTTSPBETDBMBPOEEE TMJEF 5SZ\ʜ^Ͱғͬͯྫ֎Λ 5SZܕʹม 5SZ
ΞϓϦέʔγϣϯαʔϏε wϢʔεέʔεهड़Λॻ͘Α͏ʹ wϢʔεέʔεͱͯ͠ΤϥʔΛද໌͢Δ w%PNBJO&SSPS 3FQPTJUPSZ&SSPS ྫ֎ Λ$POWFSU
ΞϓϦέʔγϣϯΤϥʔ wϢʔεέʔεͱͯ͠ͷ Τϥʔද໌ w/PU'PVOE w#BE3FRVFTU w4ZTUFN&SSPS
$POWFSUΛཧ w%PNBJO&SSPS"QQMJDBUJPO&SSPS w3FQPTJUPSZ&SSPS"QQMJDBUJPO&SSPS wྫ֎"QQMJDBUJPO&SSPS
$POWFSUΛཧ wΤϥʔܕΛද໌ͨ͜͠ͱͰ$POWFSU͕ େม wશͯ"QQMJDBUJPO&SSPSʹ͢Δ w$POWFSUΛ͏·࣮͘͠ͳ͍ͱਏ͍
object ApplicationErrorConverters { implicit class DomainError2ApplicationError[E](val e: Either[DomainError, E]) extends
AnyVal { def toApplicationError: Either[ApplicationError, E] = e.fold( l => Left(BadRequestError(Option(l.message))), Right(_) ) } }
object ApplicationErrorConverters { implicit class RepositoryError2ApplicationError[E](val e: Either[RepositoryError, E]) extends
AnyVal { def toApplicationError: Either[ApplicationError, E] = e.fold( { case _: RepositoryOptimisticError => Left(ConflictError) case _: RepositoryNotFoundError => Left(NoContentsError) case _: RepositoryAlreadyExistsError => Left(BadRequestError(Some("already_exists"))) case RepositorySystemError(t) => Left(InternalServerError(t)) }, Right(_) ) } }
object ApplicationErrorConverters { implicit class Try2ApplicationError[E](val e: Try[E]) extends AnyVal
{ def toApplicationError: Either[ApplicationError, E] = e.fold( e => Left(InternalServerError(e)), Right(_) ) } }
ΠϯλʔϑΣʔε
ΠϯϑϥετϥΫνϟ Πϯϑϥ αʔϏε υϝΠϯ ϨΠϠʔͰѻ͏Τϥʔ ΠϯλʔϑΣʔε ΞϓϦέʔγϣϯ ϑΝΫτϦ ΤϯςΟςΟ υϝΠϯ
αʔϏε ϦϙδτϦ ΠϕϯτύϒϦ ογϟ ϦϙδτϦ࣮ Πϕϯτ ύϒϦογϟ࣮ +BWBϥΠϒϥϦ +%#$υϥΠό ྫ֎ ϦϙδτϦ Τϥʔ ΞϓϦέʔγ ϣϯΤϥʔ υϝΠϯ Τϥʔ ࢀߟIUUQTTQFBLFSEFDLDPNDSPTTSPBETDBMBPOEEE TMJEF 5SZ\ʜ^Ͱғͬͯྫ֎Λ 5SZܕʹม 5SZ
"QQMJDBUJPO&SSPSΛ$POWFSU w)551εςʔλεʹม w/PU'PVOE w#BE3FRVFTU w*OUFSOBM4FSWFS&SSPS
)551Ҏ֎ͷΠϯλϑΣʔε w4VCTDSJCFS w3FDJFWFS w$PNNBOE-JOF*OUFSGBDF
4VCTDSJCFS w/PU'PVOE4LJQ w#BE3FRVFTU4LJQ w*OUFSOBM4FSWFS&SSPS3FUSZ
ΠϯλϑΣʔεʹґଘ͢Δ wΠϯλϑΣʔε͕)551ͳΒ)551ʹ w4VC3FDJFWFSͳΒ4LJQ͔3FUSZ wӬԕʹղফ͞Εͳ͍3FUSZΛ࡞ͬͯॲ ཧΛԆͤ͞ͳ͍Α͏அ͕ཁΔ
'JO