devondragon / jira-omnifocus

Ruby script to create and manage OmniFocus tasks based on your Jira tickets
Apache License 2.0
120 stars 40 forks source link

Crashing on bad issue URI #16

Closed geordan closed 8 years ago

geordan commented 8 years ago

Error when running .jiraomnifocus.rb

./jiraomnifocus.rb:240:in `block (2 levels) in mark_resolved_jira_tickets_as_complete_in_omnifocus': undefined local variable or method `issue' for main:Object (NameError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:852:in `start'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/net/http.rb:582:in `start'
    from ./jiraomnifocus.rb:211:in `block in mark_resolved_jira_tickets_as_complete_in_omnifocus'
    from ./jiraomnifocus.rb:201:in `each'
    from ./jiraomnifocus.rb:201:in `find'
    from ./jiraomnifocus.rb:201:in `each'
    from ./jiraomnifocus.rb:201:in `mark_resolved_jira_tickets_as_complete_in_omnifocus'
    from ./jiraomnifocus.rb:254:in `main'
    from ./jiraomnifocus.rb:258:in `<main>'

So I changed line 206 of jiraomnifocus.rb to the following in an attempt to see what issue was causing the... issue.

# check status of the jira
  uri = URI(JIRA_BASE_URL + '/rest/api/2/issue/' + jira_id)
  puts jira_id

Apparently it's trying to look at "http://intranet/jira/secure/admin/SDMailInfo.jspa"

devondragon commented 8 years ago

The SDMailInfo.jspa thing is related to Service Desk, which I don't have to test against. It looks like it's grabbing a bad URL from a task note(s) in one of your OmniFocus tasks. Is this happening for all your Jira ticket related OF Tasks? Or do you just have one weird task with an odd link in the note?

geordan commented 8 years ago

Ah, that was it. I removed the note from a task that referenced the URL http://intranet/jira/secure/admin/SDMailInfo.jspa and everything is happy again.

On Mon, Oct 19, 2015 at 7:17 PM, Devon Hillard notifications@github.com wrote:

The SDMailInfo.jspa thing is related to Service Desk, which I don't have to test against. It looks like it's grabbing a bad URL from a task note(s) in one of your OmniFocus tasks. Is this happening for all your Jira ticket related OF Tasks? Or do you just have one weird task with an odd link in the note?

— Reply to this email directly or view it on GitHub https://github.com/devondragon/jira-omnifocus/issues/16#issuecomment-149406013 .

devondragon commented 8 years ago

Glad I could help!

If other people start running into this, I could try to make the logic a bit smarter, but for now I'll hope it was a rare snafu!