message: refactor: handle the error the sdk way
diff: @@ -96,30 +96,31 @@ export const getRestoreLocation: ResolverFn = async (
  region: awsS3Parts ? R.prop(1, awsS3Parts) : ''
  });
  - try {
  +
  // before generating the signed url, check the object exists
  - s3Client.headObject({
  + await s3Client.headObject({
  Bucket: R.prop(2, s3Parts),
  Key: R.prop(3, s3Parts)
  - });
  - } catch (error) {
  - // delete the restore from the database if the head check fails
  + }, async function(err, data) {
  + if (err) {
  + // if there is an error, then delete the restore from the database
  await query(
  sqlClientPool,
  Sql.deleteRestore({
  backupId
  })
  );
  - // return an error?
  - throw new Error('The requested restore is no longer available, try retrieve the backup again');
  - }
  -
  + return ""
  + } else {
  + // otherwise return the signed url
  return s3Client.getSignedUrl('getObject', {
  Bucket: R.prop(2, s3Parts),
  Key: R.prop(3, s3Parts),
  Expires: 300 // 5 minutes
  });
  }
  + });
  + }
  return restoreLocation;
  };
  