Are there any tutorials or guidance on handling errors and how to display a message to the user?
At the moment I have a function that extends the user class to allow {$user.getApiResults} to return an array and make it available to the template. At the moment if an admin has not entered the API key into the options the function crashes and makes the page unavailable.
How can I pass back a meaningful error to the user, and also avoid the page crashing if the API key is missing?
Second question is around option validation - I'd like to make sure that the user only ever inputs an alphanumeric API key into the options, and only run the function if that's correct.
What's the best way of doing this?
At the moment I have a function that extends the user class to allow {$user.getApiResults} to return an array and make it available to the template. At the moment if an admin has not entered the API key into the options the function crashes and makes the page unavailable.
How can I pass back a meaningful error to the user, and also avoid the page crashing if the API key is missing?
Second question is around option validation - I'd like to make sure that the user only ever inputs an alphanumeric API key into the options, and only run the function if that's correct.
What's the best way of doing this?