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
Exception Handling in PHP
Search
Frank Neff
November 06, 2014
Programming
2
110
Exception Handling in PHP
A lightning Talk about exception handling best practices in PHP for one of our customers
Frank Neff
November 06, 2014
Tweet
Share
More Decks by Frank Neff
See All by Frank Neff
Principles of Object Orientation
frne
0
240
Symfony High Availability in the Cloud
frne
0
410
Symfony 3 [german]
frne
0
400
Solr für Volltext-Suche oder gleich als Datenbank Engine
frne
0
290
Plaing with Neo4j -[:USING]-> PHP
frne
0
380
PHP under the hood
frne
3
200
Other Decks in Programming
See All in Programming
GitHub Actionsで泣かないためにやっておきたい設定 / Recommended GHA settings to avoid crying
pinkumohikan
3
540
ゆるい個人開発のススメ
kuroppe1819
10
990
Milestoner
bkuhlmann
1
410
⼤規模⾔語モデルの拡張(RAG)が 終わったかも知れない件について
nearme_tech
23
15k
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
810
デフォルトにして至高、RubyMineの大好きな所
ruzia
0
410
Behind VS Code Extensions for JavaScript / TypeScript Linnting and Formatting
unvalley
5
920
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
新宿ダンジョンを可視化してみた
satoshi7190
2
260
Anthropic Cookbook のおすすめレシピ
schroneko
7
980
Java 22 Overview
kishida
1
180
Apache Hive 4 on Treasure Data
ryukobayashi
0
340
Featured
See All Featured
Ruby is Unlike a Banana
tanoku
96
10k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Code Review Best Practice
trishagee
55
15k
Building Better People: How to give real-time feedback that sticks.
wjessup
355
18k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
34
8.9k
Gamification - CAS2011
davidbonilla
76
4.6k
Adopting Sorbet at Scale
ufuk
68
8.6k
Faster Mobile Websites
deanohume
299
30k
Become a Pro
speakerdeck
PRO
11
4.5k
Visualization
eitanlees
136
14k
GraphQLとの向き合い方2022年版
quramy
32
12k
Transcript
try { Exception Handling in PHP } A brief introduction
Exception != Error
– docs.oracle.com “An exception is an event, which occurs during
the execution of a program, that disrupts the normal flow of the program's instructions.”
– php.net/manual “When an exception is thrown, code following the
statement will not be executed, and PHP will attempt to find the first matching catch block. If an exception is not caught, a PHP Fatal Error will be issued with an "Uncaught Exception ..." message”
Application Layers Presentation Business Data NoDatabaseConnectionException NoResultException EmptyResultException InvalidConfigurationException HTTP/404
HTTP/500
Example EVIL!
– Me “Because a DBAL does not know how to
handle an empty result… But the business logic does!”
Done right
Done right
Pass Exceptions through layers
Exceptions
DBAL
Repository
Controller
– OSS Development Wisdom “An API method should always return
an expected result or throw an exception.”
Thanks ;) frankneff.ch - @frank_neff - github.com/frne