export class NotFoundError extends Error { constructor ( entityTypeName ) { super ( `The ${ entityTypeName } is not found.` ) ; Object . setPrototypeOf ( this , NotFoundError . prototype ) ; Error . captureStackTrace ( this , NotFoundError ) ; } } export const expectFound = ( entityTypeName ) => < T > ( value ) : T => { if ( value == null ) throw new NotFoundError ( entityTypeName ) ; return value ; } ;