本文整理汇总了TypeScript中bunyan.error函数的典型用法代码示例。如果您正苦于以下问题:TypeScript error函数的具体用法?TypeScript error怎么用?TypeScript error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: errorHandler
public errorHandler (err: Error) {
switch (err.message) {
case 'X-Hub-Signature does not match blob signature':
case 'No X-Hub-Signature found on request':
logger.error('Go to https://github.com/settings/apps/YOUR_APP and verify that the Webhook secret matches the value of the WEBHOOK_SECRET environment variable.')
break
case 'error:0906D06C:PEM routines:PEM_read_bio:no start line':
case '{"message":"A JSON web token could not be decoded","documentation_url":"https://developer.github.com/v3"}':
logger.error('Your private key (usually a .pem file) is not correct. Go to https://github.com/settings/apps/YOUR_APP and generate a new PEM file. If you\'re deploying to Now, visit https://probot.github.io/docs/deployment/#now.')
break
default:
logger.error(err)
}
}
示例2: callback
waterline_obj.initialize(orm.config, (err, ontology) => {
if (err != null)
return callback(err);
else if (ontology == null || ontology.connections == null || ontology.collections == null
|| ontology.connections.length === 0 || ontology.collections.length === 0) {
logger.error('waterline_obj.initialize::ontology =', ontology, ';');
return callback(new TypeError('Expected ontology with connections & waterline_collections'));
}
// Tease out fully initialised models.
logger.info('Waterline initialised with:\t', Object.keys(ontology.collections), ';');
return callback(null, { connection: ontology.connections, collections: ontology.collections });
});
示例3: tweetImage
export default async function tweetImage(logger: Logger) {
try {
const { fileName, file } = await getRandomPicture();
const b64Picture = file.toString('base64');
const uploadedPicture = await t.post('media/upload', {
stringify_ids: true,
media_data: b64Picture,
});
const mediaParams = {
stringify_ids: true,
// @ts-ignore
media_id: uploadedPicture.data.media_id_string,
alt_text,
};
await t.post('media/metadata/create', mediaParams);
const tweet = await t.post('statuses/update', {
stringify_ids: true,
status: config.twitter.tweetMessage,
// @ts-ignore
media_ids: [uploadedPicture.data.media_id_string],
});
logger.info({
status: config.twitter.tweetMessage,
// @ts-ignore
mediaIds: uploadedPicture.data.media_id_string,
image: fileName,
// @ts-ignore
tweet: tweet.data.id_str,
});
} catch (e) {
logger.error(e);
}
}