Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
152d31ba
Commit
152d31ba
authored
Jun 28, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic error handling to API calls
parent
f2894890
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
30 deletions
+33
-30
login.component.ts
Breeze.UI/src/app/login/login.component.ts
+7
-9
create.component.ts
Breeze.UI/src/app/setup/create/create.component.ts
+4
-3
recover.component.ts
Breeze.UI/src/app/setup/recover/recover.component.ts
+4
-3
dashboard.component.ts
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
+14
-12
history.component.ts
Breeze.UI/src/app/wallet/history/history.component.ts
+4
-3
No files found.
Breeze.UI/src/app/login/login.component.ts
View file @
152d31ba
...
@@ -104,10 +104,10 @@ export class LoginComponent implements OnInit {
...
@@ -104,10 +104,10 @@ export class LoginComponent implements OnInit {
}
}
},
},
error
=>
{
error
=>
{
let
errorMessage
=
<
any
>
error
;
if
(
error
.
status
===
0
)
{
if
(
error
.
status
>=
400
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
alert
(
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
console
.
log
(
errorMessage
);
alert
(
error
);
}
}
}
}
)
)
...
@@ -125,12 +125,10 @@ export class LoginComponent implements OnInit {
...
@@ -125,12 +125,10 @@ export class LoginComponent implements OnInit {
}
}
},
},
error
=>
{
error
=>
{
let
errorMessage
=
<
any
>
error
;
if
(
error
.
status
===
0
)
{
if
(
error
.
status
===
403
&&
error
.
json
().
errors
[
0
].
message
===
"Wrong password, please try again."
)
{
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
alert
(
"Wrong password, try again."
);
}
else
if
(
error
.
status
>=
400
)
{
}
else
if
(
error
.
status
>=
400
)
{
alert
(
errorMessage
);
alert
(
error
);
console
.
log
(
errorMessage
);
}
}
}
}
)
)
...
...
Breeze.UI/src/app/setup/create/create.component.ts
View file @
152d31ba
...
@@ -98,9 +98,10 @@ export class CreateComponent {
...
@@ -98,9 +98,10 @@ export class CreateComponent {
}
}
},
},
error
=>
{
error
=>
{
if
(
error
.
status
>=
400
)
{
if
(
error
.
status
===
0
)
{
let
errorMessage
=
error
;
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
console
.
log
(
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
}
}
)
)
...
...
Breeze.UI/src/app/setup/recover/recover.component.ts
View file @
152d31ba
...
@@ -112,9 +112,10 @@ export class RecoverComponent implements OnInit {
...
@@ -112,9 +112,10 @@ export class RecoverComponent implements OnInit {
}
}
},
},
error
=>
{
error
=>
{
if
(
error
.
status
>=
400
)
{
if
(
error
.
status
===
0
)
{
this
.
errorMessage
=
error
;
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
console
.
log
(
this
.
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
}
}
);
);
...
...
Breeze.UI/src/app/wallet/dashboard/dashboard.component.ts
View file @
152d31ba
...
@@ -50,17 +50,18 @@ export class DashboardComponent {
...
@@ -50,17 +50,18 @@ export class DashboardComponent {
this
.
walletBalanceSubscription
=
this
.
apiService
.
getWalletBalance
(
walletInfo
)
this
.
walletBalanceSubscription
=
this
.
apiService
.
getWalletBalance
(
walletInfo
)
.
subscribe
(
.
subscribe
(
response
=>
{
response
=>
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
if
(
response
.
status
>=
200
&&
response
.
status
<
400
)
{
let
balanceResponse
=
response
.
json
();
let
balanceResponse
=
response
.
json
();
this
.
confirmedBalance
=
balanceResponse
.
balances
[
0
].
amountConfirmed
;
this
.
confirmedBalance
=
balanceResponse
.
balances
[
0
].
amountConfirmed
;
this
.
unconfirmedBalance
=
balanceResponse
.
balances
[
0
].
amountUnconfirmed
;
this
.
unconfirmedBalance
=
balanceResponse
.
balances
[
0
].
amountUnconfirmed
;
}
}
},
},
error
=>
{
error
=>
{
if
(
error
.
status
>=
400
)
{
if
(
error
.
status
===
0
)
{
let
errorMessage
=
<
any
>
error
;
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
console
.
log
(
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
}
alert
(
error
);
}
}
}
)
)
;
;
...
@@ -78,9 +79,10 @@ export class DashboardComponent {
...
@@ -78,9 +79,10 @@ export class DashboardComponent {
}
}
},
},
error
=>
{
error
=>
{
if
(
error
.
status
>=
400
)
{
if
(
error
.
status
===
0
)
{
let
errorMessage
=
<
any
>
error
;
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
console
.
log
(
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
}
}
)
)
...
...
Breeze.UI/src/app/wallet/history/history.component.ts
View file @
152d31ba
...
@@ -41,9 +41,10 @@ export class HistoryComponent {
...
@@ -41,9 +41,10 @@ export class HistoryComponent {
}
}
},
},
error
=>
{
error
=>
{
if
(
error
.
status
>=
400
)
{
if
(
error
.
status
===
0
)
{
this
.
errorMessage
=
<
any
>
error
;
alert
(
"Something went wrong while connecting to the API. Please restart the application."
);
console
.
log
(
this
.
errorMessage
);
}
else
if
(
error
.
status
>=
400
)
{
alert
(
error
);
}
}
}
}
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment