mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'cordova-hcp' of github.com:meteor/meteor into cordova-hcp
This commit is contained in:
12
packages/logging/logging_cordova.js
Normal file
12
packages/logging/logging_cordova.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Log all uncaught errors so they can be printed to the developer.
|
||||
// But since Android's adb catlog already prints the uncaught exceptions, we
|
||||
// can disable it for Android.
|
||||
if (! /Android/i.test(navigator.userAgent)) {
|
||||
window.onerror = function (msg, url, line) {
|
||||
// Cut off the url prefix, the meaningful part always starts at 'www/' in
|
||||
// Cordova apps.
|
||||
url = url.replace(/^.*?\/www\//, '');
|
||||
console.log('Uncaught Error: ' + msg + ':' + line + ':' + url);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ Package.on_use(function (api) {
|
||||
api.export('Log');
|
||||
api.use(['underscore', 'ejson']);
|
||||
api.add_files('logging.js');
|
||||
api.add_files('logging_cordova.js', 'client.cordova');
|
||||
});
|
||||
|
||||
Package.on_test(function (api) {
|
||||
|
||||
@@ -405,7 +405,7 @@ var execCordovaOnPlatform = function (localPath, platformName) {
|
||||
// remove a part of file url we don't like
|
||||
line = line.replace(/^file:\/\/\/android_asset\/www\//, '');
|
||||
// filename.js?hashsha1: Line 123 : message goes here
|
||||
var parsedLine = line.match(/^([^?]+)\?[a-zA-Z0-9]+: Line (\d+) : (.*)$/);
|
||||
var parsedLine = line.match(/^([^?]+)(\?[a-zA-Z0-9]+)?: Line (\d+) : (.*)$/);
|
||||
|
||||
if (! parsedLine)
|
||||
return Log.format(Log.objFromText(line), { color: true });
|
||||
@@ -414,8 +414,8 @@ var execCordovaOnPlatform = function (localPath, platformName) {
|
||||
time: new Date,
|
||||
level: 'info',
|
||||
file: parsedLine[1],
|
||||
line: parsedLine[2],
|
||||
message: parsedLine[3],
|
||||
line: parsedLine[3],
|
||||
message: parsedLine[4],
|
||||
program: 'android'
|
||||
};
|
||||
return Log.format(output, {
|
||||
|
||||
Reference in New Issue
Block a user