Mercurial > repos > prog > lcmsmatching
diff MsDbChecker.R @ 6:f86fec07f392 draft default tip
planemo upload commit c397cd8a93953798d733fd62653f7098caac30ce
author | prog |
---|---|
date | Fri, 22 Feb 2019 16:04:22 -0500 |
parents | fb9c0409d85c |
children |
line wrap: on
line diff
--- a/MsDbChecker.R Wed Apr 19 10:00:05 2017 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -if ( ! exists('MsDbChecker')) { # Do not load again if already loaded - - source('MsDbObserver.R') - - ##################### - # CLASS DECLARATION # - ##################### - - MsDbChecker <- setRefClass("MsDbChecker", contains = 'MsDbObserver', fields = list(.fail = 'logical')) - - ############### - # CONSTRUCTOR # - ############### - - # fail If set to TRUE, will fail (i.e.: quit application with a status set to 1) on error. - MsDbChecker$methods( initialize = function(fail = FALSE, ...) { - - .fail <<- if ( ! is.null(fail) && ! is.na(fail)) fail else FALSE - - callSuper(...) # calls super-class initializer with remaining parameters - }) - - ########### - # WARNING # - ########### - - MsDbChecker$methods( warning = function(msg) { - write(paste('WARNING: ', msg), stderr()) - }) - - ######### - # ERROR # - ######### - - MsDbChecker$methods( error = function(msg) { - - write(paste('ERROR:', msg), stderr()) - - # Fail - if (.self$.fail) - quit(status = 1) - }) - -} # end of load safe guard