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
130
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
300
Symfony High Availability in the Cloud
frne
0
570
Symfony 3 [german]
frne
0
420
Solr für Volltext-Suche oder gleich als Datenbank Engine
frne
0
330
Plaing with Neo4j -[:USING]-> PHP
frne
0
430
PHP under the hood
frne
3
210
Other Decks in Programming
See All in Programming
Zendeskのチケットを Amazon Bedrockで 解析した
ryokosuge
3
270
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
17
8.5k
「待たせ上手」なスケルトンスクリーン、 そのUXの裏側
teamlab
PRO
0
210
実用的なGOCACHEPROG実装をするために / golang.tokyo #40
mazrean
1
220
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
200
🔨 小さなビルドシステムを作る
momeemt
3
660
サーバーサイドのビルド時間87倍高速化
plaidtech
PRO
0
700
ソフトウェアテスト徹底指南書の紹介
goyoki
1
140
Jakarta EE Core Profile and Helidon - Speed, Simplicity, and AI Integration
ivargrimstad
0
330
CSC305 Summer Lecture 12
javiergs
PRO
0
130
コンテキストエンジニアリング Cursor編
kinopeee
1
750
Processing Gem ベースの、2D レトロゲームエンジンの開発
tokujiros
2
120
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
520
The World Runs on Bad Software
bkeepers
PRO
70
11k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Thoughts on Productivity
jonyablonski
70
4.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.5k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Being A Developer After 40
akosma
90
590k
A designer walks into a library…
pauljervisheath
207
24k
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