Documentation / @blazetrails/activemodel / Errors
Class: Errors<TBase>
Defined in: packages/activemodel/lib/errors.ts:31
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
TBase extends object | object |
Constructors
Constructor
new Errors<
TBase>(base):Errors<TBase>
Defined in: packages/activemodel/lib/errors.ts:66
Parameters
| Parameter | Type |
|---|---|
base | TBase | null |
Returns
Errors<TBase>
Accessors
attributeNames
Get Signature
get attributeNames(): readonly
string[]
Defined in: packages/activemodel/lib/errors.ts:142
Returns
readonly string[]
count
Get Signature
get count():
number
Defined in: packages/activemodel/lib/errors.ts:283
Returns
number
details
Get Signature
get details():
Map<string, readonlyErrorDetailHash[]>
Defined in: packages/activemodel/lib/errors.ts:157
Returns
Map<string, readonly ErrorDetailHash[]>
errors
Get Signature
get errors():
Error[]
Defined in: packages/activemodel/lib/errors.ts:58
Returns
Error[]
fullMessages
Get Signature
get fullMessages(): (
string|null)[]
Defined in: packages/activemodel/lib/errors.ts:224
Returns
(string | null)[]
messages
Get Signature
get messages():
Map<string, readonly (string|null)[]>
Defined in: packages/activemodel/lib/errors.ts:150
Returns
Map<string, readonly (string | null)[]>
objects
Get Signature
get objects():
Error[]
Defined in: packages/activemodel/lib/errors.ts:62
Returns
Error[]
size
Get Signature
get size():
number
Defined in: packages/activemodel/lib/errors.ts:48
Returns
number
Methods
[iterator]()
[iterator]():
IterableIterator<Error>
Defined in: packages/activemodel/lib/errors.ts:310
Returns
IterableIterator<Error>
add()
add(
attribute,type?,options?):Error
Defined in: packages/activemodel/lib/errors.ts:171
Parameters
| Parameter | Type | Default value |
|---|---|---|
attribute | string | undefined |
type | string | ((record, options) => string) | null | ":invalid" |
options? | { message?: string | ((record, options) => string); } & Record<string, unknown> | undefined |
Returns
added()
added(
attribute,type?,options?):boolean
Defined in: packages/activemodel/lib/errors.ts:196
Parameters
| Parameter | Type | Default value |
|---|---|---|
attribute | string | undefined |
type | string | ((record, options) => string) | ":invalid" |
options? | Record<string, unknown> | undefined |
Returns
boolean
asJson()
asJson(
options?):Hash<string, (string|null)[]>
Defined in: packages/activemodel/lib/errors.ts:146
Parameters
| Parameter | Type | Default value |
|---|---|---|
options | Record<string, unknown> | null | null |
Returns
Hash<string, (string | null)[]>
clear()
clear():
void
Defined in: packages/activemodel/lib/errors.ts:40
Returns
void
copyBang()
copyBang<
U>(other):void
Defined in: packages/activemodel/lib/errors.ts:74
Type Parameters
| Type Parameter |
|---|
U extends object |
Parameters
| Parameter | Type |
|---|---|
other | Errors<U> |
Returns
void
delete()
delete(
attribute,type?,options?): (string|null)[] |null
Defined in: packages/activemodel/lib/errors.ts:125
Parameters
| Parameter | Type |
|---|---|
attribute | string |
type? | string |
options? | Record<string, unknown> |
Returns
(string | null)[] | null
dup()
dup():
this
Defined in: packages/activemodel/lib/errors.ts:279
Returns
this
each()
each(
fn):Error[]
Defined in: packages/activemodel/lib/errors.ts:35
Parameters
| Parameter | Type |
|---|---|
fn | (error) => void |
Returns
Error[]
first()
Call Signature
first():
Error|null
Defined in: packages/activemodel/lib/errors.ts:307
Returns
Error | null
Call Signature
first(
n):Error[]
Defined in: packages/activemodel/lib/errors.ts:308
Parameters
| Parameter | Type |
|---|---|
n | number |
Returns
Error[]
fullMessage()
fullMessage(
attribute,message):string|null
Defined in: packages/activemodel/lib/errors.ts:237
Parameters
| Parameter | Type |
|---|---|
attribute | string |
message | string | null |
Returns
string | null
Missing Rails Name
base — PERMANENT
fullMessagesFor()
fullMessagesFor(
attribute): readonly (string|null)[]
Defined in: packages/activemodel/lib/errors.ts:228
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
readonly (string | null)[]
generateMessage()
generateMessage(
attribute,type?,options?):string
Defined in: packages/activemodel/lib/errors.ts:242
Parameters
| Parameter | Type | Default value |
|---|---|---|
attribute | string | undefined |
type | string | ":invalid" |
options | Record<string, unknown> | {} |
Returns
string
Missing Rails Name
base — PERMANENT
get()
get(
attribute): (string|null)[]
Defined in: packages/activemodel/lib/errors.ts:138
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
(string | null)[]
groupByAttribute()
groupByAttribute():
Hash<string,Error[]>
Defined in: packages/activemodel/lib/errors.ts:167
Returns
Hash<string, Error[]>
hasKey()
hasKey(
attribute):boolean
Defined in: packages/activemodel/lib/errors.ts:117
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
boolean
import()
import(
error,overrideOptions?):void
Defined in: packages/activemodel/lib/errors.ts:82
Parameters
| Parameter | Type |
|---|---|
error | Error |
overrideOptions | { attribute?: string; type?: string; } |
overrideOptions.attribute? | string |
overrideOptions.type? | string |
Returns
void
Missing Rails Name
base — PERMANENT
initializeDup()
initializeDup(
other):void
Defined in: packages/activemodel/lib/errors.ts:70
Parameters
| Parameter | Type |
|---|---|
other | Errors<TBase> |
Returns
void
inspect()
inspect():
string
Defined in: packages/activemodel/lib/errors.ts:298
Returns
string
isAny()
isAny(
block?):boolean
Defined in: packages/activemodel/lib/errors.ts:309
Parameters
| Parameter | Type |
|---|---|
block? | (error) => unknown |
Returns
boolean
isEmpty()
isEmpty():
boolean
Defined in: packages/activemodel/lib/errors.ts:44
Returns
boolean
isInclude()
isInclude(
attribute):boolean
Defined in: packages/activemodel/lib/errors.ts:113
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
boolean
isKey()
isKey(
attribute):boolean
Defined in: packages/activemodel/lib/errors.ts:121
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
boolean
map()
map<
R>(block):R[]
Defined in: packages/activemodel/lib/errors.ts:306
Type Parameters
| Type Parameter |
|---|
R |
Parameters
| Parameter | Type |
|---|---|
block | (error) => R |
Returns
R[]
mergeBang()
mergeBang<
U>(other):Error[]
Defined in: packages/activemodel/lib/errors.ts:94
Type Parameters
| Type Parameter |
|---|
U extends object |
Parameters
| Parameter | Type |
|---|---|
other | Errors<U> |
Returns
Error[]
messagesFor()
messagesFor(
attribute): (string|null)[]
Defined in: packages/activemodel/lib/errors.ts:232
Parameters
| Parameter | Type |
|---|---|
attribute | string |
Returns
(string | null)[]
ofKind()
ofKind(
attribute,type?):boolean
Defined in: packages/activemodel/lib/errors.ts:211
Parameters
| Parameter | Type | Default value |
|---|---|---|
attribute | string | undefined |
type | string | ((record, options) => string) | ":invalid" |
Returns
boolean
toArray()
toArray(): (
string|null)[]
Defined in: packages/activemodel/lib/errors.ts:294
Returns
(string | null)[]
toHash()
toHash(
fullMessages?):Hash<string, (string|null)[]>
Defined in: packages/activemodel/lib/errors.ts:287
Parameters
| Parameter | Type | Default value |
|---|---|---|
fullMessages | boolean | false |
Returns
Hash<string, (string | null)[]>
toJSON()
Call Signature
toJSON(
options):unknown
Defined in: packages/activesupport/dist/core-ext/object/json.d.ts:15
Parameters
| Parameter | Type |
|---|---|
options | string |
Returns
unknown
Inherited from
ToJsonWithActiveSupportEncoder.toJSON
Call Signature
toJSON(
options?):string
Defined in: packages/activesupport/dist/core-ext/object/json.d.ts:16
Parameters
| Parameter | Type |
|---|---|
options? | EncodeOptions | null |
Returns
string
Inherited from
ToJsonWithActiveSupportEncoder.toJSON
uniqBang()
uniqBang():
void
Defined in: packages/activemodel/lib/errors.ts:52
Returns
void
where()
where(
attribute,type?,options?):Error[]
Defined in: packages/activemodel/lib/errors.ts:104
Parameters
| Parameter | Type |
|---|---|
attribute | string |
type? | string | ((record, options) => string) |
options? | Record<string, unknown> |
Returns
Error[]