Is it possible to return a custom error from a Dynamic Pipeline, and have it displayed in the Pipeline page instead of stuff like the following?
Selected Dynamic Pipelines provider is malformed and can't be invoked: There was an error invoking the function - Cannot read properties of null (reading 'pipe')
The part after the dash is a JS error caused by someone sending me a script with a null array element (they wrote a "-" with no string after it in the pipeline script YML array).
I want to catch that and return an error message to tell them to fix it instead of working around it.
As things stand, I had to go through the Forge Logs to figure out what went wrong and why I was getting a null where only a string or a non-null object are expected.
It gets stranger: I updated my code so that it just returns the null/undefined step without processing, and the error still says "Cannot read properties of null (reading 'pipe')". But that code is not executed anymore, as far as I can see when using the tunnel. But I also have a result, because the dynamic pipeline did not crash, contrary to what the red message says: "This pipeline is generated by dynamic pipelines. View the configuration"
And lightbulb moment: Just throw an `Error` object with the message. It will be displayed in the red message. Such simplicity, and I had to make it so complicated...