error print

This commit is contained in:
lastlink 2019-05-07 12:02:37 -04:00
parent 0e802df186
commit 13be5d8eb6
2 changed files with 48 additions and 30 deletions

15
app.js
View File

@ -127,6 +127,9 @@
$$('input').map(function ($el) { $el.disabled = true; }); $$('input').map(function ($el) { $el.disabled = true; });
$$('button').map(function ($el) { $el.disabled = true; }); $$('button').map(function ($el) { $el.disabled = true; });
try {
var opts = { var opts = {
jwk: JSON.parse($('textarea[name="jwk"]').value), jwk: JSON.parse($('textarea[name="jwk"]').value),
claims: { claims: {
@ -136,6 +139,7 @@
}; };
Keypairs.signJwt(opts).then(function (msg) { Keypairs.signJwt(opts).then(function (msg) {
document.getElementById(`sign-error`).innerText = null;
$('.js-jwt').innerText = msg; $('.js-jwt').innerText = msg;
$('.js-toc-jwt').hidden = false; $('.js-toc-jwt').hidden = false;
var msgArr = msg.split(".") var msgArr = msg.split(".")
@ -152,7 +156,18 @@
$('.js-pem-loading').hidden = true; $('.js-pem-loading').hidden = true;
$$('input').map(function ($el) { $el.disabled = false; }); $$('input').map(function ($el) { $el.disabled = false; });
$$('button').map(function ($el) { $el.disabled = false; }); $$('button').map(function ($el) { $el.disabled = false; });
}).catch(function (error) {
document.getElementById(`sign-error`).innerText = error.message
$('.js-pem-loading').hidden = true;
$$('input').map(function ($el) { $el.disabled = false; });
$$('button').map(function ($el) { $el.disabled = false; });
}) })
} catch (error) {
document.getElementById(`sign-error`).innerText = error.message
$('.js-pem-loading').hidden = true;
$$('input').map(function ($el) { $el.disabled = false; });
$$('button').map(function ($el) { $el.disabled = false; });
}
}); });

View File

@ -15,6 +15,9 @@
white-space: -o-pre-wrap; /* Opera 7 */ white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE */ word-wrap: break-word; /* IE */
} }
.errors {
color: red;
}
</style> </style>
</head> </head>
<body> <body>