go-agent icon indicating copy to clipboard operation
go-agent copied to clipboard

Custom Error Response

Open sdalezman opened this issue 4 years ago • 4 comments

Hi -

I was looking through the library and there's currently no way to write a different error other than the html and response code that Sqreen sends.

I would like to show a custom error message on our React app when Sqreen shows an aborted request. I did notice that there were hooks in the internal package to enable those error messages, but maybe I missed it in my quick scan to be able to hook into those hooks?

I would set a custom status code in the Sqreen dashboard but that's not possible (only allows 400-599 status codes).

Thanks!

sdalezman avatar Oct 16 '19 03:10 sdalezman

Hi,

Thanks for your feedback. This is indeed a common feature request we have and will solve in the future (still unplanned though).

I was looking through the library and there's currently no way to write a different error other than the html and response code that Sqreen sends.

You are right. Today, you can only set the HTTP status code of the blocking Sqreen page or make it a HTTP redirection to your custom URL in the settings page)

I would like to show a custom error message on our React app when Sqreen shows an aborted request.

So we suggest for now to either:

  • redirect to your custom error page,
  • or set a custom HTTP status code (indeed in the 400-599 range) that will have the special meaning "sqreen has blocked the request" for your React app so that you can then display whatever you want.

Would it do the job for now?

Julio-Guerra avatar Oct 16 '19 08:10 Julio-Guerra

Yea that makes sense! Adding the status code in that range probably makes the most sense!

sdalezman avatar Oct 16 '19 12:10 sdalezman

Hello @sdalezman Quick update about this: better supporting API services is one of our main goals this year and we should solve this with a better solution (likely the ability to better configure the response along with information).

Julio-Guerra avatar May 20 '20 08:05 Julio-Guerra

Thanks for the update!

On Wed, May 20, 2020 at 4:23 AM Julio Guerra [email protected] wrote:

Hello @sdalezman https://github.com/sdalezman Quick update about this: better supporting API services is one of our main goals this year and it should solve this with a better solution (likely the ability to better configure the response along with information).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sqreen/go-agent/issues/82#issuecomment-631320334, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZXEFNBELFWHAMA45LKRGTRSOHO5ANCNFSM4JBFWEAQ .

-- Shlomo Dalezman CTO/Co-Founder, Intello https://www.intello.io/ 914.609.5030

sdalezman avatar May 26 '20 01:05 sdalezman