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
140
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
370
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
400
Plaing with Neo4j -[:USING]-> PHP
frne
0
470
PHP under the hood
frne
3
220
Other Decks in Programming
See All in Programming
実装をデザインガイドラインに追従させるための取り組み / 260731-dip-mosh-design-system
dachi023
0
7.8k
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
220
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
380
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
220
Hono + Inertia + React で LP を構築した話
oukayuka
2
170
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
290
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
120
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
520
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
550
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
270
メールのエイリアス機能を履き違えない
isshinfunada
0
260
初めての模倣学習とVLA
natsutan
0
280
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
First, design no harm
axbom
PRO
2
1.3k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.5k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
220
Site-Speed That Sticks
csswizardry
13
1.5k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Navigating Team Friction
lara
192
16k
Optimizing for Happiness
mojombo
378
71k
Odyssey Design
rkendrick25
PRO
2
780
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Chasing Engaging Ingredients in Design
codingconduct
0
280
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