try {
// Block of code to try
YourSubMicroflow
}
catch(Exception e) {
// Block of code to handle errors
YourErrorhandlingFlow
}
To wrap your function in a try-catch code in Mendix, first create the try block as YourSubMicroflow, then call it and set the Error handler to Custom (with or without rollback, whichever suits the situation best):
Then set your errorhandling in a separate path below it, maybe also in a subflow:
BTW You do know the marketplace module OIDC SSO? This might be close to what you are trying to build.