@@ -62,6 +62,7 @@ import {
6262 getSelfServePurchaseBlockReason ,
6363} from "~/services/platform.v3.server" ;
6464import { textLinkClassName } from "~/components/primitives/TextLink" ;
65+ import { logger } from "~/services/logger.server" ;
6566import { rbac } from "~/services/rbac.server" ;
6667import { requireUserId } from "~/services/session.server" ;
6768import { cn } from "~/utils/cn" ;
@@ -81,6 +82,9 @@ import { pageMeta } from "~/utils/pageTitle";
8182
8283export const meta = pageMeta ( "Manage concurrency" ) ;
8384
85+ const LOAD_ERROR_MESSAGE = "Unable to load concurrency settings. Please try again." ;
86+ const SAVE_ERROR_MESSAGE = "Unable to save concurrency settings. Please try again." ;
87+
8488export const loader = async ( { request, params } : LoaderFunctionArgs ) => {
8589 const userId = await requireUserId ( request ) ;
8690 const {
@@ -113,9 +117,14 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
113117 ) ;
114118
115119 if ( error ) {
120+ logger . error ( "Failed to load concurrency settings" , {
121+ error,
122+ organizationId : project . organizationId ,
123+ projectId : project . id ,
124+ } ) ;
116125 throw new Response ( undefined , {
117- status : 400 ,
118- statusText : error . message ,
126+ status : 500 ,
127+ statusText : LOAD_ERROR_MESSAGE ,
119128 } ) ;
120129 }
121130
@@ -201,12 +210,16 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
201210 ) ;
202211
203212 if ( error ) {
213+ logger . error ( "Failed to allocate concurrency" , {
214+ error,
215+ organizationId : project . organizationId ,
216+ projectId : project . id ,
217+ } ) ;
204218 return json (
205219 submission . reply ( {
206- fieldErrors : {
207- environments : [ error instanceof Error ? error . message : "Unknown error" ] ,
208- } ,
209- } )
220+ fieldErrors : { environments : [ SAVE_ERROR_MESSAGE ] } ,
221+ } ) ,
222+ { status : 500 }
210223 ) ;
211224 }
212225
@@ -250,10 +263,16 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
250263 ) ;
251264
252265 if ( error ) {
266+ logger . error ( "Failed to update concurrency add-on" , {
267+ error,
268+ organizationId : project . organizationId ,
269+ projectId : project . id ,
270+ } ) ;
253271 return json (
254272 submission . reply ( {
255- fieldErrors : { amount : [ error instanceof Error ? error . message : "Unknown error" ] } ,
256- } )
273+ fieldErrors : { amount : [ SAVE_ERROR_MESSAGE ] } ,
274+ } ) ,
275+ { status : 500 }
257276 ) ;
258277 }
259278
0 commit comments