forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMissingJoinColumnError.ts
More file actions
20 lines (18 loc) · 949 Bytes
/
MissingJoinColumnError.ts
File metadata and controls
20 lines (18 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { EntityMetadata } from "../metadata/EntityMetadata"
import { RelationMetadata } from "../metadata/RelationMetadata"
import { TypeORMError } from "./TypeORMError"
export class MissingJoinColumnError extends TypeORMError {
constructor(entityMetadata: EntityMetadata, relation: RelationMetadata) {
super()
if (relation.inverseRelation) {
this.message =
`JoinColumn is missing on both sides of ${entityMetadata.name}#${relation.propertyName} and ` +
`${relation.inverseEntityMetadata.name}#${relation.inverseRelation.propertyName} one-to-one relationship. ` +
`You need to put JoinColumn decorator on one of the sides.`
} else {
this.message =
`JoinColumn is missing on ${entityMetadata.name}#${relation.propertyName} one-to-one relationship. ` +
`You need to put JoinColumn decorator on it.`
}
}
}