Skip to content

Commit f0f5b05

Browse files
committed
add onError hook method
1 parent c657f3f commit f0f5b05

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

projects/fusio-sdk/src/lib/abstract/detail.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export abstract class Detail<T> implements OnInit {
3535
this.onLoad();
3636
} catch (error) {
3737
this.response = this.error.convert(error);
38+
39+
this.onError();
3840
}
3941
}
4042

@@ -64,4 +66,8 @@ export abstract class Detail<T> implements OnInit {
6466
protected onLoad(): void
6567
{
6668
}
69+
70+
protected onError(): void
71+
{
72+
}
6773
}

projects/fusio-sdk/src/lib/abstract/form.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export abstract class Form<T> implements OnInit {
4444
this.onLoad();
4545
} catch (error) {
4646
this.response = this.error.convert(error);
47+
48+
this.onError();
4749
}
4850
}
4951

@@ -54,6 +56,8 @@ export abstract class Form<T> implements OnInit {
5456
this.onSubmit();
5557
} catch (error) {
5658
this.response = this.error.convert(error);
59+
60+
this.onError();
5761
}
5862
}
5963

@@ -64,6 +68,8 @@ export abstract class Form<T> implements OnInit {
6468
this.onSubmit();
6569
} catch (error) {
6670
this.response = this.error.convert(error);
71+
72+
this.onError();
6773
}
6874
}
6975

@@ -74,6 +80,8 @@ export abstract class Form<T> implements OnInit {
7480
this.onSubmit();
7581
} catch (error) {
7682
this.response = this.error.convert(error);
83+
84+
this.onError();
7785
}
7886
}
7987

@@ -99,6 +107,10 @@ export abstract class Form<T> implements OnInit {
99107
{
100108
}
101109

110+
protected onError(): void
111+
{
112+
}
113+
102114
protected beforeCreate(entity: T): T
103115
{
104116
return entity;

projects/fusio-sdk/src/lib/abstract/list.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ export abstract class List<T> implements OnInit {
5353
this.onLoad();
5454
} catch (error) {
5555
this.response = this.error.convert(error);
56+
57+
this.onError();
5658
}
5759
}
5860

@@ -121,4 +123,8 @@ export abstract class List<T> implements OnInit {
121123
protected onLoad(): void
122124
{
123125
}
126+
127+
protected onError(): void
128+
{
129+
}
124130
}

0 commit comments

Comments
 (0)