Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16153

CLI: Hook system has wrong callback signatures and poor error handling

    Details

      Description

      The hook system has a big issue where the "pre" function hook signature differs from the "post". This is a bug. They should be the same and the "post" is correct, the "pre" is not.

      Both the "pre" and "post" should have the first argument be a possible error object. The second arg should be the "data" object.

      The hook system only processes errors for post hooks, not pre hooks. So, by fixing the "pre" function signature, fixing up error handling to prevent the hook from finishing should be easy.

      This shouldn't impact plugins or the SDK with these changes since "pre" hooks are used often.

      The fire hook callback (the calls from the SDK) current emit 3 args, though only 2 make sense. We should fix this, but this will break 3.2.0. This can be fixed by checking the callback function length.

      Lastly, the if a pre or post function hook should fail, then all places in the SDK that fire a hook should look for errors and gracefully abort the operation.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cbarber Chris Barber
                Reporter:
                cbarber Chris Barber
                Reviewer:
                Allen Yeung
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18159
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code