@@ -114,18 +114,20 @@ function storage(p5, fn){
114114 */
115115 fn . storeItem = function ( key , value ) {
116116 if ( typeof key !== 'string' ) {
117- console . log (
118- `The argument that you passed to storeItem() - ${ key } is not a string.`
117+ p5 . _friendlyError (
118+ `The argument that you passed to storeItem() - ${ key } is not a string.` ,
119+ 'storeItem'
119120 ) ;
120121 }
121122 if ( key . endsWith ( 'p5TypeID' ) ) {
122- console . log (
123- `The argument that you passed to storeItem() - ${ key } must not end with 'p5TypeID'.`
123+ p5 . _friendlyError (
124+ `The argument that you passed to storeItem() - ${ key } must not end with 'p5TypeID'.` ,
125+ 'storeItem'
124126 ) ;
125127 }
126128
127129 if ( typeof value === 'undefined' ) {
128- console . log ( 'You cannot store undefined variables using storeItem().' ) ;
130+ p5 . _friendlyError ( 'You cannot store undefined variables using storeItem().' , 'storeItem ') ;
129131 }
130132 let type = typeof value ;
131133 switch ( type ) {
@@ -263,8 +265,9 @@ function storage(p5, fn){
263265 let value = localStorage . getItem ( key ) ;
264266 const type = localStorage . getItem ( `${ key } p5TypeID` ) ;
265267 if ( typeof type === 'undefined' ) {
266- console . log (
267- `Unable to determine type of item stored under ${ key } in local storage. Did you save the item with something other than setItem()?`
268+ p5 . _friendlyError (
269+ `Unable to determine type of item stored under ${ key } in local storage. Did you save the item with something other than setItem()?` ,
270+ 'getItem'
268271 ) ;
269272 } else if ( value !== null ) {
270273 switch ( type ) {
@@ -418,8 +421,9 @@ function storage(p5, fn){
418421 */
419422 fn . removeItem = function ( key ) {
420423 if ( typeof key !== 'string' ) {
421- console . log (
422- `The argument that you passed to removeItem() - ${ key } is not a string.`
424+ p5 . _friendlyError (
425+ `The argument that you passed to removeItem() - ${ key } is not a string.` ,
426+ 'removeItem'
423427 ) ;
424428 }
425429 localStorage . removeItem ( key ) ;
0 commit comments