Commits

ZyX_I committed 82c51f3

ftplugin/aurumlog: Added some throws. Ref #12

Comments (0)

Files changed (1)

ftplugin/aurumlog.vim

             \                     '@/mappings': '0.0',})
 let s:_messages={
             \'nocontents': 'Log is empty',
+            \    'noprev': 'Can’t find any revision before %s',
+            \    'nonext': 'Can’t find any revision after %s',
+            \    'nopars': 'Revision %s has no parents',
         \}
 let s:ignkeys=['crrestrict', 'filepats', 'revs', 'cmd', 'repo']
 "▶1 findCurSpecial :: bvar, hex, blockstart + cursor → special
         return cmd.'curfile '.hex."\n"
     else
         let cs=bvar.repo.changesets[hex]
-        if !empty(cs.parents)
-            return cmd.hex.' '.cs.parents[0]."\n"
+        if empty(cs.parents)
+            call s:_f.throw('nopars', hex)
         endif
+        return cmd.hex.' '.cs.parents[0]."\n"
     endif
-    return ''
 endfunction
 "▶1 gethexfile
 function s:F.gethexfile()
                     \':silent diffsplit '.
                     \fnameescape(s:_r.fname('file', bvar.repo, cs.parents[0],
                     \                       file))."\n"
+    else
+        call s:_f.throw('nopars', hex)
     endif
-    return ''
 endfunction
 "▶1 findfirstvisible :: n → hex
 function s:F.findfirstvisible(n)
             break
         endif
     endwhile
+    if lastfoundhex is# hex
+        call s:_f.throw('no'.((a:n>0)?('prev'):('next')), hex)
+    endif
     return "\<C-\>\<C-n>".(bvar.csstarts[lastfoundhex]+1).'gg'
 endfunction
 "▶1 next