How to use the error function from loglevel

Find comprehensive JavaScript loglevel.error code examples handpicked from public code repositorys.

550
551
552
553
554
555
556
557
558
559
	log.debug('block {');
	block = parseBlock();
	log.debug('}');
	ensureHandle(block);
             if(!block.name)
                 log.error('block with handle "' + block.handle + '" is missing a name.');
	else
                 blocks[block.name] = block;
} else {
	logUnhandledGroup(curr);
fork icon70
star icon264
watch icon0

169
170
171
172
173
174
175
176
177
178
    // We already checked that val is of the correct type above,
    // so we can go ahead and set it.
    S.set(key, val);
} else {    // This shouldn't happen, so it's a log.error if it does.
    let m = `Unexpected type ${typeof val} for ${key} - skipping`;
    log.error(m);
    stash(m);
    ok = false;
    continue;
}
fork icon27
star icon150
watch icon15

+ 11 other calls in file

1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
} else {                                    // New first tab
    treeidx = orig_tidxes[ctab.index];
}

if(treeidx === false) {
    log.error({"Could not find where to put tab": ctab, "in window": winvn});
    return false;
}

// --- Create the model entry if there isn't one ---
fork icon27
star icon150
watch icon15

+ 10 other calls in file

121
122
123
124
125
126
127
128
129
130
proc.stdout.on('data', (data) => {
  log.info(data.toString());
});

proc.stderr.on('data', (data) => {
  log.error(data.toString());
});

// Success
has_mounted_volume_root = true
fork icon15
star icon29
watch icon5

+ 97 other calls in file

139
140
141
142
143
144
145
146
147
148
149
            } catch (err) {
                log.error(getTimestamp() + ' ERROR: ' + err)
            }
        }
    } catch (err) {
        log.error(getTimestamp() + ' ERROR: Sync error. ' + err)
    }
}


/**
fork icon8
star icon27
watch icon3

+ 279 other calls in file

90
91
92
93
94
95
96
97
98
99
100
101


    try {
        saveWallet(wallet)
    } catch (err) {
        console.log(err)
        log.error('Error while saving wallet during interval.')
    }
}


/**
fork icon8
star icon27
watch icon3

+ 155 other calls in file

65
66
67
68
69
70
71
72
73
74
75
76
            Buffer.from(req.body.payload, 'hex')
        )


        res.json(result)
    } catch (err) {
        log.error(getTimestamp() + ' ERROR: Some error occurred while sending message. ' + err)
        res.json("Sorry, but your request is invalid.")
    }


}
fork icon8
star icon27
watch icon3

+ 43 other calls in file

18
19
20
21
22
23
24
25
26
27
  log.debug('handleError', error);
  if (error.name === 'AbortError') {
    // Ignore `AbortError`
    log.debug('Aborted', error);
  } else {
    log.error('API call failed. ' + error.name, error.message, error);
    throw error;
  }
}

fork icon151
star icon24
watch icon10

87
88
89
90
91
92
93
94
95
96

    loginStatus = `Login called, expecting redirect function to redirect the user's browser now...`;
    log.info(loginStatus);
  } catch (error) {
    loginStatus = `Login attempt failed: [${error}]`;
    log.error(loginStatus);
    sendHtmlResponse(res);
  }
} else {
  next(
fork icon34
star icon52
watch icon12

+ 4 other calls in file

49
50
51
52
53
54
55
56
57
58
}


amqp.connect(`amqp://${settings.RABBITMQ.address}`, opt, async (err, conn) => {
    if (err) {
        log.error('Failed to connect to RABBITMQ', err)
        process.exit(1)
    }
    conn.createChannel(async (err, ch) => {
        if (err) {
fork icon5
star icon21
watch icon3

+ 3 other calls in file

200
201
202
203
204
205
206
207
208
209
  .map(attachment => attachment.url)
  .filter(url => url.search(/jpg|jpeg|png/));

if (imageUrls.length > 0) {
  message.react('🤔')
    .catch(err => log.error(err));

  let raidCreated = false;

  const processingChain = Promise.resolve();
fork icon20
star icon15
watch icon0

+ 21 other calls in file

46
47
48
49
50
51
52
53
54
55
                    log.error('Error in awsMemcached set: ', err);
                }
            });
        }
    } catch (err) {
        log.error('Error in awsMemcached set: ', err);
        return undefined;
    }
}

fork icon7
star icon13
watch icon1

+ 2 other calls in file

173
174
175
176
177
178
179
180
181
182
            );
            reply.type('application/octet-stream');
            reply.code(200).send(cacheData);
        }
    } catch (error) {
        log.error('TLM Proxy Error: ', error);
        reply.code(500).send(error);
    }
}

fork icon7
star icon13
watch icon1

39
40
41
42
43
44
45
46
47
48

try {
    // This throws an exception if JWT isn't able to be validated
    await verifier.verify(token);
} catch (error) {
    log.error('JWT verifier error: ', error);
    const response = {
        status: '401',
        statusDescription: 'Unauthorized',
        body: 'Unauthorized',
fork icon7
star icon13
watch icon1

107
108
109
110
111
112
113
114
115
116
    VIEW_MGR = new EncryptionBasedViewMgr(fabric_front, VIEW_MODE, WORKLOAD_CHAINCODEID, viewstorage_contractID);; 
    
} else if (DATA_HIDING_SCHEME == global.PlainScheme) {
    VIEW_MGR = new PlainViewMgr(fabric_front, VIEW_MODE, WORKLOAD_CHAINCODEID, viewstorage_contractID);; 
} else {
    LOGGER.error(`Unrecognized Data Hiding Scheme ${DATA_HIDING_SCHEME}`);
    process.exit(1);
}

var view_creation_promises = [];
fork icon2
star icon7
watch icon1

+ 5 other calls in file

155
156
157
158
159
160
161
162
163
164

    await run({ ...executionParameters });

} catch (error) {

    logger.error(error.message)

    callback(error)
}
callback()
fork icon6
star icon3
watch icon1

22
23
24
25
26
27
28
29
30
31
  const localeFilePath = getLocalePath(code);
  const fileContents = await readFile(localeFilePath, 'utf8');
  return JSON.parse(fileContents);
} catch (e) {
  if (e.code === 'ENOENT') {
    log.error('Locale file not found');
  } else {
    log.error(`Error opening your locale ("${code}") file: `, e);
  }
  process.exit(1);
fork icon4
star icon14
watch icon1

+ 15 other calls in file

103
104
105
106
107
108
109
110
111
112
                        .then(() => {
                            ipcRenderer.invoke("window-channel", "captureSignal", "data");
                        });
                }
            });
        } else log.error("FileReader has problems reading blob");
    };
};
try {
    this.mediaRecorder.stop();
fork icon3
star icon4
watch icon2

+ 3 other calls in file

16
17
18
19
20
21
22
23
24
25
26
27
28


request.get('/api/config')
    .end(function(err, res) {


        if (err) {
            logger.error(err);
            return;
        }


        var config = res.body;
fork icon2
star icon4
watch icon0

161
162
163
164
165
166
167
168
169
170
  var strippedErrors = _errors.map(function (error) {
    return stripAnsi(error);
  });
  sendMsg('Errors', strippedErrors);
  for (var i = 0; i < strippedErrors.length; i++) {
    log.error(strippedErrors[i]);
  }
  if (useErrorOverlay) overlay.showMessage(_errors);
  initial = false;
},
fork icon0
star icon2
watch icon0

+ 4 other calls in file