Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raising an error and short-circuiting the execution of remaining operators #470

Open
mickvikt opened this issue Aug 15, 2023 · 1 comment
Assignees
Labels
documentation Documentation may be added or completed on the portal

Comments

@mickvikt
Copy link

In the initial stage of our data processing pipeline, we verify the presence of a predefined set of files. If any of these files are missing, we need to raise an error. Is there a recommended practice for triggering errors, such as invoking a specific method, or is raising an exception the sole approach for handling this situation? Thank you

@paillave
Copy link
Owner

paillave commented Aug 18, 2023

The way to trigger an error the proper way is to simply raise an exception in the operator where the issue occurs :)

If you want more information about the reason and location of the failure:

var res = await processRunner.ExecuteAsync(args[0], executionOptions);
if (res.ErrorTraceEvent.Content is UnhandledExceptionStreamTraceContent unhandledExceptionStreamTraceContent)
{
    Console.WriteLine($"Error occurred in node {res.ErrorTraceEvent.NodeName}(type {res.ErrorTraceEvent.NodeTypeName}): {unhandledExceptionStreamTraceContent.Message} (exception: {unhandledExceptionStreamTraceContent.Exception})");
}
Console.Write(res.Failed ? "Failed" : "Succeeded");

@paillave paillave self-assigned this Aug 18, 2023
@paillave paillave added the documentation Documentation may be added or completed on the portal label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation may be added or completed on the portal
Projects
None yet
Development

No branches or pull requests

2 participants