atuttle / atom-language-cfml

:space_invader: A CFML Language for the Atom Editor
38 stars 24 forks source link

Uncaught TypeError: Cannot read property 'emitter' of undefined #39

Closed atuttle closed 9 years ago

atuttle commented 9 years ago

Opened an ORM entity and got this exception:

Atom Version: 1.0.0 System: Mac OS X 10.10.4 Thrown From: language-cfml package, v0.8.4

Stack Trace

Uncaught TypeError: Cannot read property 'emitter' of undefined

At /Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:128

TypeError: Cannot read property 'emitter' of undefined
  at bindCfcChangeChecker (/Users/adam/.atom/packages/language-cfml/lib/languageCFML.js:71:32)
  at /Users/adam/.atom/packages/language-cfml/lib/languageCFML.js:24:5
  at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:82:11)
  at /Applications/Atom.app/Contents/Resources/app.asar/src/workspace.js:492:25
  at _fulfilled (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:794:54)
  at self.promiseDispatch.done (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:823:30)
  at Promise.promise.promiseDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:756:13)
  at /Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:564:44
  at flush (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:110:17)
  at process._tickCallback (node.js:357:13)

Commands

     -0:51.8.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:51.4.0 core:save (atom-text-editor.editor.is-focused)
     -0:28.7.0 core:backspace (atom-text-editor.editor.is-focused)
     -0:28 core:move-up (atom-text-editor.editor.is-focused)
     -0:27.7.0 editor:newline (atom-text-editor.editor.is-focused)
  5x -0:25.7.0 core:backspace (atom-text-editor.editor.is-focused)
  3x -0:17.9.0 core:move-down (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:17.3.0 core:move-up (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:17 autocomplete-plus:confirm (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:17 snippets:expand (atom-text-editor.editor.is-focused.autocomplete-active)
     -0:15.4.0 editor:move-to-first-character-of-line (atom-text-editor.editor.is-focused)
     -0:14.9.0 core:delete (atom-text-editor.editor.is-focused)
     -0:14.3.0 editor:move-to-end-of-word (atom-text-editor.editor.is-focused)
  5x -0:14 core:move-right (atom-text-editor.editor.is-focused)
     -0:04.4.0 fuzzy-finder:toggle-file-finder (atom-text-editor.editor.is-focused)
     -0:00.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "apathy-theme"
    ]
  }
}

Installed Packages

# User
apathy-theme, v1.5.1
language-cfml, v0.8.4

# Dev
No dev packages

The entity code is:

component
    output = "false"
    mappedSuperClass="true"
    table = "EMSEvent"
{

    property name="eventId" fieldtype="id" generator="identity";
    property name="externalEventId" sqltype="varchar(40)" hint="the advance/banner/peoplesoft event identifier";
    property name="guid" sqltype="varchar(36)" hint="for public exposure";

    property name="eventgroupname" sqltype="nvarchar(200)" hint="if we are grouping this event, make this the same for every event in the bundle";

    property name="Skin"
                fieldtype="many-to-one"
                cfc="Skin"
                fkColumn="skinId"
                hint="the html wrapper template to be used for this registration flow";

    property name="ConfirmationEmailTemplate"
                fieldtype="many-to-one"
                cfc="orm.EmailTemplate"
                fkColumn="emailTemplateId"
                hint="the template to wrap confirmation emails in";

    property    name="Account"
                fieldtype="many-to-one"
                cfc="Account"
                fkColumn="accountId"
                notnull="false"
                hint="default account to drop event revenues in to";

    property    name="FiscalYear"
                fieldtype="many-to-one"
                cfc="FiscalYear"
                fkColumn="fiscalYearId"
                notnull="true"
                hint="fiscal year for transactions";

    property name="name" sqltype="nvarchar(200)" hint="actual name of the event";
    property name="shortname" sqltype="nvarchar(50)" hint="name without XML-invalid characters (including spaces)";
    property name="intro" sqltype="text" hint="introductory text for the registration landing page";
    property name="friendlyURL" sqltype="varchar(200)" hint="just the part of the url that handles redirection. system responsible for the rest.";
    property name="marketingURL" sqltype="varchar(200)" hint="url of the event's marketing website (if any)";

    property name="contactName" sqltype="varchar(200)" hint="who to talk to with questions";
    property name="contactPhone" sqltype="varchar(20)" hint="phone number of a human contact";
    property name="contactEmailAddress" sqltype="varchar(50)" hint="email address of a human contact";
    property name="confirmationNote" sqltype="text" hint="per-event message to be included in the confirmation email";
    property name="confirmationSenderEmailAddress" sqltype="varchar(50)" hint="email address that confirmation emails come from";
    property name="confirmationCCEmailAddresses" sqltype="varchar(150)" hint="email addresses to copy the confirmation emails to";

    /*
        NOTE:   Convention is to set all booleans to the most favorable/ideal configuration by default
                This means that the field is tilted to indicate permissiveness wherever possible and 1 is better than 0.
    */

    property name="showEventTimes" sqltype="tinyint" dbdefault="1" hint="if 0, hide start/end time in favor of tour time(s)";
    property name="dateTimeEventStart" ormtype="timestamp" sqltype="datetime" hint="";
    property name="dateTimeEventEnd" ormtype="timestamp" sqltype="datetime" hint="";

    property name="isPublic" sqltype="tinyint" dbdefault="1" hint="if 0, do not show in calendar regardless of calendar dates";
    property name="dateTimeCalendarStart" ormtype="timestamp" sqltype="datetime" hint="";
    property name="dateTimeCalendarEnd" ormtype="timestamp" sqltype="datetime" hint="";

    property name="isRegisterable" sqltype="tinyint" dbdefault="1" hint="if 0, this event is a calendar entry only and not a registerable event";
    property name="dateTimeRegistrationStart" ormtype="timestamp" sqltype="datetime" hint="";
    property name="dateTimeRegistrationEnd" ormtype="timestamp" sqltype="datetime" hint="";

    property name="maxGuests" sqltype="tinyint" dbdefault="9" hint="rarely will we need to cap the num of guests on a registration but if we have to, we can. maxGuests DOES NOT INCLUDE PRIMARY REGISTRANT.";

    property name="isAuthenticationRequired" sqltype="tinyint" dbdefault="0" hint="if 1, do not allow 'naked' registration - all registrants must log in";
    property name="isOnlinePaymentEnabled" sqltype="tinyint" dbdefault="1" hint="if 0, disable online payment capability. Important to not change once registration is open!";
    property name="offlinePaymentInstructions" sqltype="nvarchar(200)" hint="if isOnlinePaymentEnabled=0, where to mail or hand over payment?";

    /* NPS section */
    property name="allowEvaluations" sqltype="tinyint" dbdefault="1" hint="if 0, do not allow registrants to evaluate this event and associated activities";
    property name="dateTimeSendEvaluationRequest" ormtype="timestamp" sqltype="datetime" hint=" to send the email to all registrants asking them to evaluate this event.";

    property name="dateTimeCreated" ormtype="timestamp" sqltype="datetime" hint="";
    property name="dateTimeClosed" ormtype="timestamp" sqltype="datetime" hint=" this event is officially closed out (no more changes permitted and money can be moved)";

    /* Activities can override, but Event location is the principal */
    property    name="Location"
                fieldtype="many-to-one"
                cfc="Location"
                fkColumn="locationId"
                notnull="false"
                hint="if specified, pointer to actual location where this event is taking place. can be overridden at Activity level";

    property    name="EventFees"
                singularname="EventFee"
                type="array"
                fieldtype="one-to-many"
                cfc="EventFee"
                fkColumn="eventId"
                inverse="true"
                hint="EventFee = a cover charge. most fees are tied to activity selections.";

    property    name="Activities"
                singularname="Activity"
                type="array"
                fieldtype="one-to-many"
                cfc="Activity"
                fkColumn="eventId"
                inverse="true";

    property    name="EventGiftDesignations"
                singularname="EventGiftDesignation"
                type="array"
                fieldtype="one-to-many"
                cfc="EventGiftDesignation"
                fkColumn="eventId"
                inverse="true";

    property    name="EventProducts"
                singularname="EventProduct"
                type="array"
                fieldtype="one-to-many"
                cfc="EventProduct"
                fkColumn="eventId"
                inverse="true";

    property    name="EventSurveyQs"
                singularname="EventSurveyQ"
                type="array"
                fieldtype="one-to-many"
                cfc="EventSurveyQ"
                fkColumn="eventId"
                inverse="true"
                hint="Survey questions: we need to know {this} for {just primaries, all adults, only guests, only children, everybody}";

    function isRegistrationOpen(){
        var isRegistrationOpen = true;
        var regStart = this.getDateTimeRegistrationStart();
        var regEnd = this.getDateTimeRegistrationEnd();
        var today = application.timeService.currentUTC();

        if(!isNull(regStart) AND dateCompare(today, regStart) lt 0){
            isRegistrationOpen = false;
        }

        if(!isNull(regEnd) AND dateCompare(regEnd, today) lt 0){
            isRegistrationOpen = false;
        }

        return isRegistrationOpen;
    }

    function getEventProducts( activeFlag = "all" ){
        switch( activeFlag ){
            case "all":
                return entityLoad("EventProduct", {event: this}, false);
            case "active":
                return entityLoad("EventProduct", {event: this, isActive: 1}, false);
            case "inactive":
                return entityLoad("EventProduct", {event: this, isActive: 1}, false);
            default:
                throw(message="Unexpected activeFlag value: `#arguments.activeFlag#`",detail="Expected one of: `all`,`active`,`inactive`.");
        }
    }

}
dajester2013 commented 9 years ago

Probably should use the workspace.onDidOpen and editor.onDidChange methods to attach the callbacks instead of working directly with the emitter.

atuttle commented 9 years ago

Seems fixed, thanks!