How to catch Moodle exceptions in a CLI script ?

Re: How to catch Moodle exceptions in a CLI script ?

by Johnny Drud -
Number of replies: 0

Hi Benjamin

You are catching the exception in a namespace. That means you have to escape the exception like this:

try

{

   // Your code

}

catch (\Exception $e)

{

   // Handle exception

}

Average of ratings: Useful (2)