This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GET influencers/_search | |
| { | |
| "size": 0, | |
| "aggregations": { | |
| "influencers": { | |
| "nested": { | |
| "path": "interests" | |
| }, | |
| "aggs": { | |
| "names": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Database (PostgreSQL) error codes. | |
| */ | |
| export const DatabaseErrorCode = { | |
| SuccessfulCompletion: "00000", | |
| Warning: "01000", | |
| DynamicResultSetsReturned: "0100C", | |
| ImplicitZeroBitPadding: "01008", | |
| NullValueEliminatedInSetFunction: "01003", | |
| PrivilegeNotGranted: "01007", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { DatabaseError } from "pg"; | |
| import { DatabaseErrorCode } from "./errors"; | |
| /** | |
| * Higher order function with fine-grained error handling. | |
| */ | |
| export async function withErrorHandling<T>( | |
| fn: () => Promise<T>, | |
| onError: Record<string, (error: PgDatabaseError) => void>, | |
| ) { |
OlderNewer