Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Commit

Permalink
add token error messge
Browse files Browse the repository at this point in the history
  • Loading branch information
okhiroyuki committed Mar 8, 2020
1 parent 28e2355 commit 77bff0e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion nodes/line-notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ module.exports = function(RED) {

node.on('input', function(msg) {
if(!node.accessToken){
sendError(node, "token is empty");
msg.payload = "token is empty";
msg.status = -1;
sendError(node, msg);
return;
}
let datajson = {
Expand Down
1 change: 1 addition & 0 deletions nodes/locales/en-US/line-nofify.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h3>Detials</h3>
<p>Message and image URL can be overwritten with msg variable only when the set value is empty.</p>
<p>If no thumbnail is specified, it will be overwritten with the full size image URL.</p>
<p>For further details of see <a href="https://notify-bot.line.me/doc/en/">LINE Notify API Document</a>.</p>
<p>If an error occurs, an error message is output to msg.payload.</p>
</script>

<script type="text/x-red" data-help-name="line-notify">
Expand Down
1 change: 1 addition & 0 deletions nodes/locales/ja/line-notify.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h3>詳細</h3>
<p>メッセージおよび画像URLは、設定した値が空の場合のみmsg変数で上書きすることが可能です。</p>
<p>サムネイルが指定されていない場合は、フルサイズの画像URLで上書きします。</p>
<p>詳しくは、<a href="https://notify-bot.line.me/doc/ja/">LINE Notify API Document</a>を参照ください。</p>
<p>エラーの場合、msg.payloadにはエラーメッセージが出力されます。</p>
</script>

<script type="text/x-red" data-help-name="line-notify">
Expand Down
3 changes: 2 additions & 1 deletion test/line-notify_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ describe("Line Notify Node", () => {
helper.load(node, flow, {creds:{accessToken: "dummy"}}, () => {
const n1 = helper.getNode("n1");
n1.on("call:error", (err) => {
should.equal(err.lastArg,"token is empty");
should.equal(err.lastArg.payload,"token is empty");
should.equal(err.lastArg.status,-1);
done();
});
n1.receive({});
Expand Down

0 comments on commit 77bff0e

Please sign in to comment.