How to handle import errors

Hi i want to display error message for corrupted bpmn file in my angular application . when i import bpmn file i am getting the error but i am not getting how to use that error in angular app.

image

this is the error i am getting but i want to display this error using angular.
Corrupted_workflow.bpmn (13.7 KB)

this is the file i am uploading. Any help will be usefull

Error handling during import is fairly simple:

modeler
  .importXML(diagram)
  .then(({ warnings }) => {
    if (warnings.length) {

      // handle warnings
      console.log(warnings);
    }

    // ...
  })
  .catch((err) => {

    // handle error
    console.log(err);
  });

using same way but error is not catching here

 modeler.importXML(xml, function (error) {
            if (error) {
                return;
            }              
        });

if we use your way then i am getting error as then is not a function

Not sure what you’re doing but this is the way it works: Import Error and Warnings Handling - CodeSandbox

can you please create same for angular application with the file i attached.

You’re the Angular expert so integrating bpmn-js with Angular is your responsibility. There is, however, an example that might help in case you’re struggling: GitHub - bpmn-io/bpmn-js-example-angular: An example how to integrate bpmn-js with an Angular application.