Can we get the reporter?
Hello,
Even if the reporter has exported methods, we can't get the reported configured neither in in Application nor in APIBuilder structure.
However, if we had an GetReporter method on them for getting the reporter, we could call Add or AddErr methods on a reporter.
I can make a push request for that, it's easy.
we can't get the reported configured neither in in Application nor in APIBuilder structure.
Yes we can, there is an exported function, app.GetReport() will return the errors as one, we don't give public access to/export the Reporter object itself because it's not used as one, it's combined with other error reporter inside the iris.Application#Build function, which is running on app.Run.
So, how do you add an error from inside a Configurator to the caller of app.Run ?
In normal case, an error done in initialization procedure should be transmitted to return of a calling of app.Run.
But in general case, if i wanted making a middleware, i'd like have add an error as like app.Favicon() do it.
With app.GetReporter().AddErr(an_error), or context.Application().GetReporter().AddErr(an_error), it would be possible.
Okay, I see your point, I thought that letting iris describes its own errors and your application its own by using a custom errors.Reporter and wrap the app.Build was a better way of doing these things. It's a small PR function without conflicts but I think users will overuse that and report strange issues, so I think it's "dangerous" to export that function. But as you wish, we've to wait for @kataras to review that and share his opinion with us. I am OK with that if helps you.
Ok, i understand.
Hello @hiveminded , @corebreaker Let's accept that, will help to reduce end-developer's code for reporting errors.