Robot Framework Integrated Development Environment (RIDE)
usererrorhandler.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from robotide.lib.robot.model import Tags
17 from robotide.lib.robot.result import Keyword as KeywordResult
18 
19 from .arguments import ArgumentSpec
20 from .statusreporter import StatusReporter
21 
22 
23 
30 
31 
36  def __init__(self, error, name, libname=None):
37  self.namename = name
38  self.libnamelibname = libname
39  self.errorerror = error
40  self.argumentsarguments = ArgumentSpec()
41  self.timeouttimeout = ''
42  self.tagstags = Tags()
43 
44  @property
45  longname = property
46 
47  def longname(self):
48  return '%s.%s' % (self.libnamelibname, self.namename) if self.libnamelibname else self.namename
49 
50  @property
51  doc = property
52 
53  def doc(self):
54  return '*Creating keyword failed:* %s' % self.errorerror
55 
56  @property
57  shortdoc = property
58 
59  def shortdoc(self):
60  return self.docdocdoc.splitlines()[0]
61 
62  def create_runner(self, name):
63  return self
64 
65  def run(self, kw, context):
66  result = KeywordResult(kwname=self.namename,
67  libname=self.libnamelibname,
68  args=kw.args,
69  assign=kw.assign,
70  type=kw.type)
71  with StatusReporter(context, result):
72  raise self.errorerror
73 
74  dry_run = run
Created if creating handlers fail – running raises DataError.
def __init__(self, error, name, libname=None)
:param robot.errors.DataError error: Occurred error.