Closed rilwis closed 7 years ago
Try and catch is the right way to do it. It goes on your site of the application though, not as part of the Spyc package.
try {
Spyc::YAMLLoad('spyc.yaml');
} catch (Exception $e) {
// do something with $e->getMessage();
}
Hi, I'd like to ask if there's a way to handle errors when parsing file? Sometimes the file or string has incorrect syntax and throw a Fatal error is not quite friendly. We need something like try...catch to make the web still works and we can show error message somehow.
Thanks.