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
130
2
Share
Exception Handling in PHP
A lightning Talk about exception handling best practices in PHP for one of our customers
Frank Neff
November 06, 2014
More Decks by Frank Neff
See All by Frank Neff
Principles of Object Orientation
frne
0
340
Symfony High Availability in the Cloud
frne
0
630
Symfony 3 [german]
frne
0
430
Solr für Volltext-Suche oder gleich als Datenbank Engine
frne
0
380
Plaing with Neo4j -[:USING]-> PHP
frne
0
460
PHP under the hood
frne
3
220
Other Decks in Programming
See All in Programming
2026-04-15 Spring IO - I Can See Clearly Now
jonatan_ivanov
1
190
「Linuxサーバー構築標準教科書」を読んでみた #ツナギメオフライン.7
akase244
0
1.4k
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
390
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
530
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.1k
PHPer、Cloudflare に引っ越す
suguruooki
1
140
JAWS-UG横浜 #100 祝・第100回スペシャルAWS は VPC レスの時代へ
maroon1st
0
220
Are We Really Coding 10× Faster with AI?
kohzas
0
120
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
AgentCore Optimizationを始めよう!
licux
3
210
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
Kubernetesを使わない環境にもCloud Nativeなデプロイを実現する / Enabling Cloud Native deployments without the complexity of Kubernetes
linyows
3
320
Featured
See All Featured
Thoughts on Productivity
jonyablonski
76
5.1k
Google's AI Overviews - The New Search
badams
0
1k
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
420
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
70
39k
Six Lessons from altMBA
skipperchong
29
4.2k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
920
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
6
630
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
33
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
170
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