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
310
Symfony High Availability in the Cloud
frne
0
620
Symfony 3 [german]
frne
0
420
Solr für Volltext-Suche oder gleich als Datenbank Engine
frne
0
350
Plaing with Neo4j -[:USING]-> PHP
frne
0
450
PHP under the hood
frne
3
220
Other Decks in Programming
See All in Programming
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
39
26k
SQL Server 2025 LT
odashinsuke
0
110
Cap'n Webについて
yusukebe
0
160
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
150
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
2.1k
Navigating Dependency Injection with Metro
l2hyunwoo
1
200
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
200
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
130
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
440
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.4k
Implementation Patterns
denyspoltorak
0
140
Featured
See All Featured
Six Lessons from altMBA
skipperchong
29
4.1k
Why Our Code Smells
bkeepers
PRO
340
58k
Speed Design
sergeychernyshev
33
1.5k
Into the Great Unknown - MozCon
thekraken
40
2.2k
BBQ
matthewcrist
89
9.9k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
58
41k
A designer walks into a library…
pauljervisheath
210
24k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
220
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
25
WCS-LA-2024
lcolladotor
0
400
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