Skip to content

Commit ccc04bd

Browse files
committed
remove error checks
1 parent b54258b commit ccc04bd

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -873,15 +873,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
873873
'CREATE TABLE IF NOT EXISTS "_SCHEMA" ( "className" varChar(120), "schema" jsonb, "isParseClass" bool, PRIMARY KEY ("className") )'
874874
)
875875
.catch(error => {
876-
if (
877-
error.code === PostgresDuplicateRelationError ||
878-
error.code === PostgresUniqueIndexViolationError ||
879-
error.code === PostgresDuplicateObjectError
880-
) {
881-
// Table already exists, must have been created by a different request. Ignore error.
882-
} else {
883-
throw error;
884-
}
876+
throw error;
885877
});
886878
}
887879

@@ -2422,23 +2414,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
24222414
}
24232415
await conn.none(qs, [indexNameOptions.name, className, ...fieldNames])
24242416
.catch(error => {
2425-
if (
2426-
error.code === PostgresDuplicateRelationError &&
2427-
error.message.includes(indexNameOptions.name)
2428-
) {
2429-
// Index already exists. Ignore error.
2430-
} else if (
2431-
error.code === PostgresUniqueIndexViolationError &&
2432-
error.message.includes(indexNameOptions.name)
2433-
) {
2434-
// Cast the error into the proper parse error
2435-
throw new Parse.Error(
2436-
Parse.Error.DUPLICATE_VALUE,
2437-
'A duplicate value for a field with unique values was provided'
2438-
);
2439-
} else {
2440-
throw error;
2441-
}
2417+
throw error;
24422418
});
24432419
}
24442420
@@ -2463,15 +2439,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
24632439
return conn
24642440
.none(qs, [ttlOptions])
24652441
.catch(error => {
2466-
if (
2467-
error.code === PostgresDuplicateRelationError ||
2468-
error.code === PostgresUniqueIndexViolationError ||
2469-
error.code === PostgresDuplicateObjectError
2470-
) {
2471-
// Function already exists, must have been created by a different request. Ignore error.
2472-
} else {
2473-
throw error;
2474-
}
2442+
throw error;
24752443
});
24762444
}
24772445
}

0 commit comments

Comments
 (0)