All files / apps/wp-editor/shared refusal.ts

25% Statements 1/4
0% Branches 0/2
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10        4x          
/** A rule said no; the message is shown to the user as-is. */
export class Refusal extends Error {}
 
/** Checked on use rather than at build, since CI builds the app with no env at all. */
export const requireEnv = (name: string, value: string | undefined): string => {
    if (!value) throw new Refusal(`${name} is not set; see apps/wp-editor/.env.example.`);
 
    return value;
};