$30 off During Our Annual Pro Sale. View Details »
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
590
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
440
PHP under the hood
frne
3
220
Other Decks in Programming
See All in Programming
dotfiles 式年遷宮 令和最新版
masawada
1
770
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
120
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
2
1k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
130
これならできる!個人開発のすゝめ
tinykitten
PRO
0
110
Cap'n Webについて
yusukebe
0
130
認証・認可の基本を学ぼう前編
kouyuume
0
200
関数実行の裏側では何が起きているのか?
minop1205
1
700
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
110
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
チームをチームにするEM
hitode909
0
330
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.3k
Featured
See All Featured
The Language of Interfaces
destraynor
162
25k
GitHub's CSS Performance
jonrohan
1032
470k
Music & Morning Musume
bryan
46
7k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Being A Developer After 40
akosma
91
590k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Done Done
chrislema
186
16k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
Facilitating Awesome Meetings
lara
57
6.7k
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