Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioricali committed Aug 2, 2017
1 parent 9daef64 commit a9c8aac
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]
## [0.1.0] - 2017-08-02
### Added
- Now constructor return `this`
- Prefix options
Expand Down
19 changes: 11 additions & 8 deletions dist/katch.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ var Log = __webpack_require__(7);
var Events = __webpack_require__(2);
var sha256 = __webpack_require__(8);

/**
* Default options
* @type {{logging: boolean, writeFile: {prefix: string, humanize: boolean, folderPath: string}}}
*/
var defaultConfig = {
logging: true,
writeFile: {
Expand All @@ -403,6 +407,7 @@ var defaultConfig = {

/**
* katch
* @constructor
* @see https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror.html
* @param opts {object} options object
*/
Expand All @@ -412,15 +417,15 @@ function katch(opts) {

if (Helpers.isBrowser()) {
window.onerror = function (msg, url, lineNo, columnNo, error) {
katch.captureError(error, {
katch.error(error, {
message: msg,
url: url,
lineNo: lineNo,
columnNo: columnNo
});
};
} else {
process.on('uncaughtException', katch.captureError);
process.on('uncaughtException', katch.error);
}

return katch;
Expand All @@ -434,7 +439,7 @@ katch.config = defaultConfig;

/**
* Set config
* @param opts
* @param opts {Object} configuration options
*/
katch.setup = function (opts) {
if ((typeof opts === 'undefined' ? 'undefined' : _typeof(opts)) === 'object') {
Expand All @@ -444,11 +449,10 @@ katch.setup = function (opts) {

/**
* Catch error
* @alias error
* @param error {Error} error object
* @param params {Object} optional params object
*/
katch.captureError = function (error) {
katch.error = function (error) {
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var logObj = {
Expand All @@ -466,11 +470,10 @@ katch.captureError = function (error) {

/**
* Catch error
* @alias captureError
* @param error {Error} error object
* @param params {Object} optional params object
*/
katch.error = katch.captureError;
katch.captureError = katch.error;

/**
* Log info
Expand Down Expand Up @@ -509,7 +512,7 @@ katch.wrap = function (func) {

/**
* Call events
* @param event {string} event name
* @param event {String} event name
* @param callback {function} callback function
*/
katch.on = Events.on;
Expand Down

0 comments on commit a9c8aac

Please sign in to comment.