n0v1c3 / vira

Create and update your Jira issues while inside Vim!
MIT License
94 stars 12 forks source link

VIRA-252: ViraReport throws unhandled exception when issue not found #52

Open chinwobble opened 3 years ago

chinwobble commented 3 years ago

branch dev

steps to repro

let g:vira_active_issue = "ABC-1234"
ViraReport

if the JIRA ABC-1234 is not found in your server, it print a stacktrace to the current buffer. It should just return an error message at the bottom.

n0v1c3 commented 3 years ago

I think you did this one just to try and catch me!

n0v1c3 commented 3 years ago

I do already have a function in autoload/vira.vim for error_msg(code, msg) I also have a concept for it just no plan as of you. I do believe the first proper step for an error guide would be a CATEGORY breakdown, Organization and then displays.

I believe I even started to adjust this error message preemptively for out async tasks and then this cam up. It may not be the same on dev right now.

Sadly display is done but that was the only truly easy part.

n0v1c3 commented 3 years ago

Current Idea:

n0v1c3 commented 3 years ago
function! vira#_select() "{{{2
  let current_pos = getpos('.')
  let value = vira#_getter()

  if expand('%:t') == 'vira_report'
      let issueTest = substitute(substitute(value,'(','','g'),')','','g')
      let issueTest = substitute(substitute(issueTest,'[','','g'),']','','g')
      let issueTest = substitute(substitute(issueTest,'{','','g'),'}','','g')
      let issueTest = substitute(issueTest,'│','','g')
    silent! if execute('python3 Vira.api.jira.search_issues("issue = ' . issueTest . '")') == ''
      let g:vira_active_issue = issueTest
      call vira#_menu('report')
    else
      call vira#_browse(expand('<cWORD>'))
    endif
  else
    call vira#_filter_load()
    if s:vira_highlight != '' && stridx(s:vira_highlight, '|' . value . '|') < 0
      if s:vira_menu_type == 'assign_issue' || s:vira_menu_type == 'epic' || s:vira_menu_type == 'issuetype' || s:vira_menu_type == 'set_status' || s:vira_menu_type == 'priority' || s:vira_menu_type == 'epic' || s:vira_menu_type == 'issues' || s:vira_menu_type == 'servers'
        let s:vira_highlight = '|' . value . '|'
      else | let s:vira_highlight = s:vira_highlight . value . '|' | endif
    elseif s:vira_highlight == ''
      let s:vira_highlight = '|' . value . '|'
    endif
    call vira#_highlight()
    call setpos('.', current_pos)
  endif
endfunction
n0v1c3 commented 3 years ago

Pretty sure I will need to start with that if statement.

n0v1c3 commented 3 years ago

A note for myself and some feedback.

Multiple servers may be possible to check. Start with the one you are in then go down the list. Then fail.

The db has a note for this already in my private notes as we will be able to find where that issue is without changing servers.