我正在为我的整个MEAN.js项目实现一个记录器.我有一个运行良好的服务器端记录器,我设置了一个端点来接收POST请求,但记录客户端错误有异常.我正在使用StackTrace.js客户端错误日志记录,但我遇到了一些错误; 现在我正在使用StackTrace的错误堆栈解析器并仍然出现错误.我在Angular的$ exceptionHandler上使用装饰器来实现这个目的:
$provide.decorator("$exceptionHandler",
function($delegate, traceService, $log, $window) {
return function(exception, cause) {
$delegate(exception, cause);
try {
var errorMessage = exception.toString();
var stackTrace = traceService.
parse(exception).
then(function(stackFrames) {
$.ajax({
type: 'POST',
url: '/logger',
contentType: 'application/json',
data: angular.toJson({
url: $window.location.href,
message: errorMessage,
type: 'exception',
stackFrace: stackFrames,
cause: cause || ''
})
}).fail(function() {
$log.warn('POST request failed');
});
}).catch(function(error) {
$log.warn('Error StackTrace');
});
} catch (loggingError) {
$log.warn('Error server-side logging failed');
$log.log(loggingError);
}
};
});
Run Code Online (Sandbox Code Playgroud)
traceService是一个Angular服务,充当StackTrace /错误堆栈解析器函数的代理. …
I'm using Kue to create jobs for my MEAN.js app. If the application is idle for some time the Redis connection is closed, apparently Kue is trying to process jobs while the connection is closed, and I get some errors.
I'm watching for stuck jobs every 6 seconds, but this doesn't seem to help avoid the errors.
app.jobs.watchStuckJobs(1000 * 6);
Run Code Online (Sandbox Code Playgroud)
These are the errors I'm getting, for each job I'm processing, after the connection is closed and before the connection …