@@ -30,6 +30,7 @@ import {
3030 validateUnPublishAsset ,
3131 sanitizePath
3232} from './utils'
33+ import { messages } from './messages'
3334
3435const debug = Debug ( 'asset-store-filesystem' )
3536
@@ -76,7 +77,7 @@ export class FSAssetStore {
7677 * @returns {Promise } returns the asset object, if successful.
7778 */
7879 public download ( asset ) {
79- debug ( 'Asset download invoked ' + JSON . stringify ( asset ) )
80+ debug ( messages . info . assetDownloadInitiated ( asset ) )
8081
8182 return new Promise ( ( resolve , reject ) => {
8283 try {
@@ -112,12 +113,12 @@ export class FSAssetStore {
112113 return resolve ( asset )
113114 } )
114115 } else {
115- return reject ( `Failed to download asset ${ JSON . stringify ( asset ) } ` )
116+ return reject ( messages . errors . assetDownloadFailed ( asset ) )
116117 }
117118 } )
118119 . catch ( reject )
119120 } catch ( error ) {
120- debug ( ` ${ asset . uid } asset download failed` )
121+ debug ( messages . info . assetDownloadFailed ( asset . uid ) )
121122
122123 return reject ( error )
123124 }
@@ -132,7 +133,7 @@ export class FSAssetStore {
132133 * @returns {Promise } returns the asset object, if successful.
133134 */
134135 public delete ( assets : IAsset [ ] ) {
135- debug ( 'Asset deletion called for' , JSON . stringify ( assets ) )
136+ debug ( messages . info . assetDeletionInitiated ( ) , JSON . stringify ( assets ) )
136137 const asset = assets [ 0 ]
137138
138139 return new Promise ( ( resolve , reject ) => {
@@ -147,11 +148,11 @@ export class FSAssetStore {
147148 . then ( ( ) => rimraf ( folderPath ) )
148149 . then ( ( ) => resolve ( asset ) )
149150 . catch ( ( error ) => {
150- debug ( `Error while removing ${ folderPath } asset file` ) ;
151+ debug ( messages . info . assetFileRemovalError ( folderPath ) ) ;
151152 return reject ( error ) ;
152153 } ) ;
153154 } else {
154- debug ( ` ${ folderPath } did not exist!` )
155+ debug ( messages . info . folderPathNotExist ( folderPath ) )
155156
156157 return resolve ( asset )
157158 }
@@ -169,7 +170,7 @@ export class FSAssetStore {
169170 * @returns {Promise } returns the asset object, if successful.
170171 */
171172 public unpublish ( asset : IAsset ) {
172- debug ( `Asset unpublish called ${ JSON . stringify ( asset ) } ` )
173+ debug ( messages . info . assetUnpublishInitiated ( asset ) )
173174
174175 return new Promise ( ( resolve , reject ) => {
175176 try {
@@ -181,11 +182,11 @@ export class FSAssetStore {
181182 . then ( ( ) => rimraf ( filePath ) )
182183 . then ( ( ) => resolve ( asset ) )
183184 . catch ( ( error ) => {
184- debug ( `Error while removing ${ filePath } asset file` ) ;
185+ debug ( messages . info . assetFileRemovalError ( filePath ) ) ;
185186 return reject ( error ) ;
186187 } ) ;
187188 }
188- debug ( ` ${ filePath } did not exist!` )
189+ debug ( messages . info . filePathNotExist ( filePath ) )
189190
190191 return resolve ( asset )
191192 } catch ( error ) {
0 commit comments