Skip to content

Commit

Permalink
Correctly propagate frontend call warnings (fixes #211)
Browse files Browse the repository at this point in the history
Change-Id: Ia571b8e6b0ba0a4edbf0501254ce2bc115f18cf6
  • Loading branch information
Akron committed Jun 12, 2024
1 parent 87cf866 commit e71bd6d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.55 2024-06-11
- Correctly propagate warnings in frontend calls. (diewald)

0.54 2024-06-10
- Remove deprecated 'matchInfo' API path. (diewald, margaretha)
- Improve footer responsiveness. (diewald)
Expand Down
14 changes: 10 additions & 4 deletions dev/js/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,16 @@ define(['util'], function () {
return;
};

if (retJSObj !== undefined && retJSObj["errors"] !== undefined) {
retJSObj["errors"].forEach(
e => KorAP.log(e[0], e[1] || "Unknown")
);
if (retJSObj !== undefined) {
if (retJSObj["errors"] !== undefined) {
retJSObj["errors"].forEach(
e => KorAP.log(e[0], e[1] || "Unknown")
);
} else if (retJSObj["warnings"] !== undefined) {
retJSObj["warnings"].forEach(
e => KorAP.log(e[0], e[1] || "Unknown", null, 'warn')
);
}
}

else if (this.status !== 200) {
Expand Down
4 changes: 2 additions & 2 deletions dev/js/src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ define([

// Override KorAP.log
window.alertify = alertifyClass;
KorAP.log = function (code, msg, src) {
KorAP.log = function (code, msg, src, type) {

if (src) {
msg += '<code class="src">'+src+'</code>';
Expand All @@ -66,7 +66,7 @@ define([
alertifyClass.log(
(code === 0 ? '' : code + ': ') +
msg,
'error',
(type ? type : 'error'),
10000
);
};
Expand Down
2 changes: 1 addition & 1 deletion lib/Kalamar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use Mojo::Util qw/url_escape deprecated slugify/;
use List::Util qw!none uniq!;

# Minor version - may be patched from package.json
our $VERSION = '0.54';
our $VERSION = '0.55';

# Supported version of Backend API
our $API_VERSION = '1.0';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Kalamar",
"description": "Mojolicious-based Frontend for KorAP",
"license": "BSD-2-Clause",
"version": "0.54.0",
"version": "0.55.0",
"pluginVersion": "0.2.2",
"engines": {
"node": ">=6.0.0"
Expand Down

0 comments on commit e71bd6d

Please sign in to comment.