File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,11 @@ export default function registry(opts: RegistryOptions = {}): RegistryCli {
106
106
try {
107
107
await put ( options . route , options . path , requestsHeaders ) ;
108
108
} catch ( err ) {
109
- let parsedError = err as any as { code ?: string ; error ?: string } ;
109
+ let parsedError = ( err as any ) . response . body || ( err as any ) ;
110
110
let errMsg = '' ;
111
- if ( ! _ . isObject ( err ) ) {
111
+ if ( ! _ . isObject ( parsedError ) ) {
112
112
try {
113
- parsedError = JSON . parse ( String ( err ) ) ;
113
+ parsedError = JSON . parse ( String ( parsedError ) ) ;
114
114
} catch ( er ) { }
115
115
}
116
116
Original file line number Diff line number Diff line change @@ -89,11 +89,7 @@ const publish = ({
89
89
await registry . putComponent ( options ) ;
90
90
logger . ok ( strings . messages . cli . PUBLISHED ( options . route ) ) ;
91
91
} catch ( err : any ) {
92
- if (
93
- err === 'Unauthorized' ||
94
- err . message === 'Unauthorized' ||
95
- err . response ?. body === 'Unauthorized'
96
- ) {
92
+ if ( err === 'Unauthorized' || err . message === 'Unauthorized' ) {
97
93
if ( ! ! options . username || ! ! options . password ) {
98
94
logger . err (
99
95
strings . errors . cli . PUBLISHING_FAIL (
You can’t perform that action at this time.
0 commit comments