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.4k
プロダクトオーナーがFour Keys + 信頼性に思うところ / Product Owners Think of Four Keys + Reliability
yoshiyoshifujii
0
460
Recapping Chatwork Scala Journey - ScalaMatsuri2023
yoshiyoshifujii
0
2.6k
ここ数ヶ月でAkkaを勉強した方法について紹介 / I have studied Akka in the past few months
yoshiyoshifujii
1
250
コードをどまんなかに据えたモデリング-Scala版 / Modeling with code in the middle-Scala version
yoshiyoshifujii
0
120
Chatworkのドメインをモデリングした / Modeling Chatwork domain
yoshiyoshifujii
0
800
サマーインターンシップ2019で学生とDDDなScala開発に取り組んだ / Working on DDD and Scala development with students at Summer Internship 2019
yoshiyoshifujii
2
4k
Clean Architecture in Practice @ScalaMatsuri2019
yoshiyoshifujii
9
3.9k
実践 Clean Architecture
yoshiyoshifujii
13
10k
Other Decks in Programming
See All in Programming
最新TCAキャッチアップ
0si43
0
190
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
110
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
みんなでプロポーザルを書いてみた
yuriko1211
0
280
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
as(型アサーション)を書く前にできること
marokanatani
10
2.7k
Realtime API 入門
riofujimon
0
150
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
43
13k
Adopting Sorbet at Scale
ufuk
73
9.1k
It's Worth the Effort
3n
183
27k
How GitHub (no longer) Works
holman
310
140k
Git: the NoSQL Database
bkeepers
PRO
427
64k
What's in a price? How to price your products and services
michaelherold
243
12k
KATA
mclloyd
29
14k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building Adaptive Systems
keathley
38
2.3k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
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