Robot Framework
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 robot.model import Tags
17 from robot.result import Keyword as KeywordResult
18 from robot.variables import VariableAssignment
19 
20 from .arguments import ArgumentSpec
21 from .statusreporter import StatusReporter
22 
23 
24 
31  supports_embedded_arguments = False
32 
33 
40  def __init__(self, error, name, libname=None, source=None, lineno=None):
41  self.errorerror = error
42  self.namename = name
43  self.libnamelibname = libname
44  self.sourcesource = source
45  self.linenolineno = lineno
46  self.argumentsarguments = ArgumentSpec()
47  self.timeouttimeout = None
48  self.tagstags = Tags()
49 
50  @property
51  longname = property
52 
53  def longname(self):
54  return '%s.%s' % (self.libnamelibname, self.namename) if self.libnamelibname else self.namename
55 
56  @property
57  doc = property
58 
59  def doc(self):
60  return '*Creating keyword failed:* %s' % self.errorerror
61 
62  @property
63  shortdoc = property
64 
65  def shortdoc(self):
66  return self.docdocdoc.splitlines()[0]
67 
68  def create_runner(self, name, languages=None):
69  return self
70 
71  def run(self, kw, context, run=True):
72  result = KeywordResult(kwname=self.namename,
73  libname=self.libnamelibname,
74  args=kw.args,
75  assign=tuple(VariableAssignment(kw.assign)),
76  type=kw.type)
77  with StatusReporter(kw, result, context, run):
78  if run:
79  raise self.errorerror
80 
81  dry_run = run
Created if creating handlers fail – running raises DataError.
def __init__(self, error, name, libname=None, source=None, lineno=None)
:param robot.errors.DataError error: Occurred error.
def create_runner(self, name, languages=None)