File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed
Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -397,20 +397,41 @@ export const useRequestsStore = defineStore('requests', {
397397 srRecord . area_of_poly == null || Number . isNaN ( Number ( srRecord . area_of_poly ) )
398398
399399 if ( areaMissing ) {
400- await updateAreaInRecord ( reqId ) // <-- uses SrParquetUtils
401- updatedArea = true
400+ try {
401+ await updateAreaInRecord ( reqId ) // <-- uses SrParquetUtils
402+ updatedArea = true
403+ } catch ( error ) {
404+ logger . warn ( 'Failed to update area for request' , {
405+ reqId,
406+ error : error instanceof Error ? error . message : String ( error )
407+ } )
408+ }
402409 }
403410
404411 // num_gran needs update?
405412 const granMissing = srRecord . num_gran == null || Number . isNaN ( Number ( srRecord . num_gran ) )
406413
407414 if ( granMissing ) {
408- await updateNumGranulesInRecord ( reqId ) // <-- uses SrParquetUtils
409- updatedGranules = true
415+ try {
416+ await updateNumGranulesInRecord ( reqId ) // <-- uses SrParquetUtils
417+ updatedGranules = true
418+ } catch ( error ) {
419+ logger . warn ( 'Failed to update granules for request' , {
420+ reqId,
421+ error : error instanceof Error ? error . message : String ( error )
422+ } )
423+ }
410424 }
411425
412426 // Always update request parameters from metadata for x endpoints
413- await updateReqParmsFromMeta ( reqId ) //for x endpoints
427+ try {
428+ await updateReqParmsFromMeta ( reqId ) //for x endpoints
429+ } catch ( error ) {
430+ logger . warn ( 'Failed to update req params from meta for request' , {
431+ reqId,
432+ error : error instanceof Error ? error . message : String ( error )
433+ } )
434+ }
414435
415436 if ( updatedArea || updatedGranules ) {
416437 await this . fetchReqs ( ) // refresh in-memory state
Original file line number Diff line number Diff line change @@ -370,6 +370,10 @@ export async function updateNumGranulesInRecord(req_id: number): Promise<void> {
370370
371371export async function updateAreaInRecord ( req_id : number ) : Promise < void > {
372372 const poly = await db . getSvrReqPoly ( req_id )
373+ // Skip if no valid polygon data
374+ if ( ! Array . isArray ( poly ) || poly . length === 0 ) {
375+ return
376+ }
373377 const area = calculatePolygonArea ( poly )
374378 await db . updateRequestRecord ( { req_id : req_id , area_of_poly : area } )
375379}
You can’t perform that action at this time.
0 commit comments