import { SearchActions } from "./search-actions.js" ; import { NotFound } from "../errors/not-found.js" ; export abstract class FindFailActions extends SearchActions { throws public async firstOrFail < T > ( ) ; public async firstOrFail ( ) { const record = await this . first ( ) ; if ( ! record ) { throw new NotFound ( ) ; } return record ; } param id throws public async findOrFail < T > ( id ) ; public async findOrFail ( id ) { const record = await this . find ( id ) ; if ( ! record ) { throw new NotFound ( ) ; } return record ; } param indexName param id throws public async findIndexOrFail < T > ( indexName , id ) ; public async findIndexOrFail ( indexName , id ) { const record = await this . findIndex ( indexName , id ) ; if ( ! record ) { throw new NotFound ( ) ; } return record ; } }