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
440
Recapping Chatwork Scala Journey - ScalaMatsuri2023
yoshiyoshifujii
0
2.5k
ここ数ヶ月でAkkaを勉強した方法について紹介 / I have studied Akka in the past few months
yoshiyoshifujii
1
250
コードをどまんなかに据えたモデリング-Scala版 / Modeling with code in the middle-Scala version
yoshiyoshifujii
0
110
Chatworkのドメインをモデリングした / Modeling Chatwork domain
yoshiyoshifujii
0
790
サマーインターンシップ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
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
150
CSC305 Lecture 13
javiergs
PRO
0
130
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
120
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
offers_20241022_imakiire.pdf
imakurusu
2
360
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
組織に自動テストを書く文化を根付かせる戦略(2024秋版) / Building Automated Test Culture 2024 Autumn Edition
twada
PRO
10
4.5k
現場で役立つモデリング 超入門
masuda220
PRO
12
2.9k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
110
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
160
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7k
Why Our Code Smells
bkeepers
PRO
334
57k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Faster Mobile Websites
deanohume
304
30k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Designing on Purpose - Digital PM Summit 2013
jponch
115
6.9k
Six Lessons from altMBA
skipperchong
26
3.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Designing for humans not robots
tammielis
249
25k
Music & Morning Musume
bryan
46
6.1k
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