Skip to content

Calling capitalize() on undefined returns an unhelpful error message #253

@MichalBryxi

Description

@MichalBryxi

The problem

When calling capitalize() on undefined:

import { capitalize } from '@ember/string';

return capitalize(undefined);

One will get a weird error:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at Cache.func (ember.debug.js:41546)
    at Cache.get (ember.debug.js:30881)
    at Object.capitalize (ember.debug.js:41770)
    at ApplicationController.get foo [as foo] (about:srcdoc:35)
    at getPossibleMandatoryProxyValue (ember.debug.js:14419)
    at get (ember.debug.js:14485)
    at ember.debug.js:46909
    at runInAutotrackingTransaction (ember.debug.js:54899)
    at track (ember.debug.js:55486)
    at PropertyReference.value (ember.debug.js:46908)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions