Skip to content

Commit 2f67d0a

Browse files
committed
log errors when building
1 parent a1da22f commit 2f67d0a

File tree

1 file changed

+26
-1
lines changed
  • apps/updateserver/services/legacy

1 file changed

+26
-1
lines changed

apps/updateserver/services/legacy/S3.cfc

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
component {
2+
variables.providerLog = "update-provider";
23
variables.NL="
34
";
45
public function init(s3Root) {
@@ -11,6 +12,14 @@ component {
1112
structDelete( application, "expressTemplates", false );
1213
}
1314

15+
private function logger( string text, any exception, type="info" ){
16+
var log = arguments.text & chr(13) & chr(10) & callstackGet('string');
17+
if ( !isNull(arguments.exception ) )
18+
WriteLog( text=log, type=arguments.type, log=variables.providerLog, exception=arguments.exception );
19+
else
20+
WriteLog( text=log, type=arguments.type, log=variables.providerLog );
21+
}
22+
1423
public function getVersions(boolean flush=false) {
1524
var rootDir = getDirectoryFromPath(getCurrentTemplatePath());
1625
var cacheDir=rootDir & "cache/";
@@ -186,7 +195,7 @@ component {
186195
return versions[keys[arrayLen(keys)]].version;
187196
}
188197

189-
private function getExpressTemplates(){
198+
public function getExpressTemplates(){
190199
if ( !structKeyExists( application, "expressTemplates" ) ) {
191200
application.expressTemplates = new expressTemplates().getExpressTemplates( s3Root );
192201
}
@@ -382,6 +391,9 @@ component {
382391
fileCopy( "zip://" & jar & "!core/core.lco", lco ); // now extract
383392
fileMove( lco, trg );
384393
}
394+
catch( e ){
395+
logger(text=e.message, type="error", exception=e);
396+
}
385397
finally {
386398
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
387399
}
@@ -429,6 +441,9 @@ component {
429441
}
430442
fileMove (warTmp, war );
431443
}
444+
catch( e ){
445+
logger(text=e.message, type="error", exception=e);
446+
}
432447
finally {
433448
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
434449
}
@@ -486,6 +501,9 @@ component {
486501
//if(fileExists(light)) fileDelete(light);
487502
if (toS3) fileMove(tmpLoaderFile,trg);
488503
}
504+
catch( e ){
505+
logger(text=e.message, type="error", exception=e);
506+
}
489507
finally {
490508
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
491509
}
@@ -549,6 +567,9 @@ component {
549567
}
550568
fileMove( zipTmp , trg );
551569
}
570+
catch( e ){
571+
logger(text=e.message, type="error", exception=e);
572+
}
552573
finally {
553574
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
554575
}
@@ -612,6 +633,10 @@ component {
612633
zipparam source=json;
613634
}
614635
fileMove( zipTmp, trg );
636+
throw "I'm a test!";
637+
}
638+
catch( e ){
639+
logger(text=e.message, type="error", exception=e);
615640
}
616641
finally {
617642
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);

0 commit comments

Comments
 (0)