lib/netprint/agent.rb in netprint-0.3.0 vs lib/netprint/agent.rb in netprint-0.3.1

- old
+ new

@@ -43,10 +43,14 @@ form = @page.form_with(name: 'NPFL0020') form.file_uploads.first.file_name = upload_filename options.apply(form) @page = form.submit(form.button_with(name: 'update-ow-btn')) - raise UploadError if @page.search('//ul[@id="svErrMsg"]/li').size == 1 + errors = @page.search('//ul[@id="svErrMsg"]/li') + + unless errors.empty? + raise UploadError.new(errors.first.text) + end get_code end end