Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

chore(error): throwing strings #3436

Merged
merged 2 commits into from
Aug 4, 2016
Merged

chore(error): throwing strings #3436

merged 2 commits into from
Aug 4, 2016

Conversation

cnishina
Copy link
Member

@cnishina cnishina commented Aug 1, 2016

  • fix throw string to throw new error
  • check typeof error is string to create a new error

@cnishina cnishina added this to the 4.0.3 milestone Aug 1, 2016
}

if (typeof filenameOrFn === 'string') {
filenameOrFn = require(resolve(configDir, filenameOrFn));
}
if (typeof filenameOrFn === 'function') {
let results = when(filenameOrFn.apply(null, args), null, (err) => {
if (err.stack) {
if (typeof err === 'string') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about

if (typeof err === 'string') {
  err = new Error(err);
}
err.stack = exports.filterStackTrace(err.stack);
throw err;

Copy link
Member

@juliemr juliemr Aug 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check if (!err.stack) instead of typeof? In case we get some crazy error object without a stack or something?

- fix throw string to throw new error
- check typeof error is string to create a new error
@cnishina cnishina merged commit 9182d58 into angular:master Aug 4, 2016
@cnishina cnishina deleted the 403_error branch August 16, 2016 20:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants