Three providers, three error formats: normalising them into one honest message

php dev.to

My little downloader site talks to three different video APIs. One handles TikTok and Instagram, one handles Facebook, and one handles YouTube. They each do the same job — take a link, return a file — but when something goes wrong, they each complain in a completely different language. If I passed those errors straight through, my visitors would see three kinds of nonsense. So I built a small normaliser, and it turned out to be one of the most useful pieces of code on the site. The pro

Read Full Tutorial open_in_new
arrow_back Back to Tutorials