From b7f2c005543782dbf9d7f918829111f5e40b019c Mon Sep 17 00:00:00 2001 From: Nathaniel Allred Date: Mon, 27 Mar 2023 08:21:29 -0500 Subject: [PATCH] return 404 if the enterprise library error returned is 404 (#22628) --- server/channels/api4/hosted_customer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/channels/api4/hosted_customer.go b/server/channels/api4/hosted_customer.go index 4792969c15..cead966f41 100644 --- a/server/channels/api4/hosted_customer.go +++ b/server/channels/api4/hosted_customer.go @@ -13,6 +13,8 @@ import ( "reflect" "time" + "github.com/pkg/errors" + "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/server/channels/utils" "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" @@ -250,6 +252,10 @@ func selfHostedInvoices(c *Context, w http.ResponseWriter, r *http.Request) { invoices, err := c.App.Cloud().GetSelfHostedInvoices() if err != nil { + if err.Error() == "404" { + c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusNotFound).Wrap(errors.New("invoices for license not found")) + return + } c.Err = model.NewAppError(where, "api.cloud.app_error", nil, "", http.StatusInternalServerError).Wrap(err) return }