StaffCoder
PHP
PHPPHP 8
10 modules · 49 challengesSign up
Module 7 of 10 · 5 challenges

PHP Exceptions

Learn how to throw and catch exceptions and clean up in finally, react to PHP's built-in exception types, design your own exception hierarchy, keep the original cause when wrapping an error, and import a supplier catalog that reports every bad row and keeps going.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

5 challenges

Locked Import Runs

Sign up to unlock
—No data yetmedium
About this challenge

One bad quantity value in the supplier feed crashes the whole stock screen, and when an import job fails halfway the import lock stays held, so the next night's run refuses to start.

Solved in a browser IDE and graded by tests. Sign up to solve

Discount Field Errors

Sign up to unlock
—No data yetmedium
About this challenge

Discount lines from the supplier feed arrive with numbers as text, missing columns or impossible percentages, and the pricing step dies on the first bad line instead of saying what went wrong with it.

Solved in a browser IDE and graded by tests. Sign up to solve

Rejected Row Types

Sign up to unlock
—No data yetmedium
About this challenge

Every import problem is reported as the same generic error, so the importer cannot tell a product row it should reject and skip from a duplicate product that must stop the whole import.

Solved in a browser IDE and graded by tests. Sign up to solve

Wrapped Import Failures

Sign up to unlock
—No data yetmedium
About this challenge

When a batch import fails, support only sees that the batch failed and has to rerun it by hand to learn which line broke and what the underlying error was.

Solved in a browser IDE and graded by tests. Sign up to solve

Supplier Catalog Import

STAR
Solving it completes the module
—No data yetmedium
About this challenge

Each supplier sends a catalog of product lines, and the import must price every good line, report each bad line with its line number and reason without stopping, stop on a repeated product, and never leave the import lock held.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.