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
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
4
640
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
C++でシェーダを書く
fadis
6
4.1k
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
みんなでプロポーザルを書いてみた
yuriko1211
0
260
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
280
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
880
subpath importsで始めるモック生活
10tera
0
300
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.4k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
CSC509 Lecture 09
javiergs
PRO
0
140
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Building Adaptive Systems
keathley
38
2.3k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Cult of Friendly URLs
andyhume
78
6k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building Your Own Lightsaber
phodgson
103
6.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Bash Introduction
62gerente
608
210k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
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