throwIfIsProvider
See also: isProvider
Throw an error for certain transports.
ts
import { throwIfIsProvider } from 'feathers-utils/hooks';Type declaration
ts
export type ThrowIfIsIsProviderOptions = {
filter?: PredicateFn
/**
* Customize the error that is thrown if the context is a provider and the service does not allow it.
* If not provided, throws a `MethodNotAllowed` error.
*/
error?: (context: HookContext) => FeathersError
}
/**
* Throw an error for certain transports.
*
* @see https://utils.feathersjs.com/hooks/throw-if-is-provider.html
*/
export declare const throwIfIsProvider: <H extends HookContext = HookContext>(
transports: TransportName | TransportName[],
options?: ThrowIfIsIsProviderOptions,
) => (context: H, next?: HookContext) => Promise<any>| Argument | Type | Description |
|---|---|---|
| transports | TransportName | TransportName[] | |
| options | ThrowIfIsIsProviderOptions |
| type | methods | multi |
|---|---|---|
| before, after, around | create, update, patch | yes |
