<s> from robot . errors import ExecutionFailed <EOL> from robot . model import Tags <EOL> from robot . result import Keyword as KeywordResult <EOL> from robot . utils import unic <EOL> from . arguments import ArgumentSpec <EOL> from . statusreporter import StatusReporter <EOL> class UserErrorHandler ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , error , libname = None ) : <EOL> self . name = name <EOL> self . libname = libname <EOL> self . error = unic ( error ) <EOL> self . arguments = ArgumentSpec ( ) <EOL> self . timeout = '<STR_LIT>' <EOL> self . tags = Tags ( ) <EOL> @ property <EOL> def longname ( self ) : <EOL> return '<STR_LIT>' % ( self . libname , self . name ) if self . libname else self . name <EOL> @ property <EOL> def doc ( self ) : <EOL> return '<STR_LIT>' % self . error <EOL> @ property <EOL> def shortdoc ( self ) : <EOL> return self . doc . splitlines ( ) [ <NUM_LIT:0> ] <EOL> def create_runner ( self , name ) : <EOL> return self <EOL> def run ( self , kw , context ) : <EOL> result = KeywordResult ( kwname = self . name , <EOL> libname = self . libname , <EOL> args = kw . args , <EOL> assign = kw . assign , <EOL> type = kw . type ) <EOL> with StatusReporter ( context , result ) : <EOL> context . fail ( self . error ) <EOL> raise ExecutionFailed ( self . error , syntax = True ) <EOL> dry_run = run </s>
