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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
360
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
390
Plaing with Neo4j -[:USING]-> PHP
frne
0
470
PHP under the hood
frne
3
220
Other Decks in Programming
See All in Programming
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
260
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
200
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
510
【やさしく解説 設計編 #1】「ドメイン駆動」と「実装駆動」ってなに? 〜設計の考え方を、たとえ話で学ぼう〜
panda728
PRO
1
110
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.3k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
160
フィードバックで育てるAI開発
kotaminato
1
110
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.2k
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.4k
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
480
Vite+ Unified Toolchain for the Web
naokihaba
0
740
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
Prompt Engineering for Job Search
mfonobong
0
370
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
290
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
590
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
220
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
630
RailsConf 2023
tenderlove
30
1.5k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
220
A designer walks into a library…
pauljervisheath
211
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