Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
Output of error stack does not contain all info

I am using PnP SPFx API in my project and I am dealing with error handling. In my code there are few API calls and I need to get a whole stack trace of the calls which were made so I can see where does the error come from.

I have also tried the Error object, Error.captureStackTrace() but obviously in Typescript it does NOT work.

Sample

  public async apiCallWrapper<T>(callback: ICallback<T>) : 
               Promise<[T, ResponseStatus, string]> {
    try {
      const result : T = await callback();
      return [result, ResponseStatus.Success, 'Success'];
    } catch(e) {
    console.log(e.stack)
    console.trace()
    return [null, ResponseStatus.Other, 'Other kind of error'];
  } 
    >> console.log(e.stack)
    Error: Error making HttpClient request in queryable [400] Bad Request ::>
    {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":
    {"lang":"en-US","value":"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."}}}
    at new HttpRequestError (https://localhost:4321/dist/sx-web-part.js:21243:28)
    at Function.<anonymous> (https://localhost:4321/dist/sx-web-part.js:21258:47)
    at step (https://localhost:4321/dist/sx-web-part.js:19733:23)
    at Object.next (https://localhost:4321/dist/sx-web-part.js:19714:53)
    at fulfilled (https://localhost:4321/dist/sx-web-part.js:19704:58)
    >> console.trace()
    overrideMethod  @   react_devtools_backend.js:2526
    (anonymous) @   BaseApi.ts:54
    step    @   sx-web-part.js:973
    (anonymous) @   sx-web-part.js:954
    fulfilled   @   sx-web-part.js:945
    Promise.then (async)        
    step    @   sx-web-part.js:947
    rejected    @   sx-web-part.js:946
    Promise.then (async)        
    step    @   sx-web-part.js:947
    (anonymous) @   sx-web-part.js:948
    0uds.__awaiter  @   sx-web-part.js:944
    0uds.BaseApi.apiCallWrapper @   BaseApi.ts:40
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

public async apiCallWrapper<T>(callback: ICallback<T>) : 
           Promise<[T, ResponseStatus, string]> {
>> stack = getStack();
try {
  const result : T = await callback();
  return [result, ResponseStatus.Success, 'Success'];
} catch(e) {
  console.log(e.stack) << stack here is not complete
  console.trace()
  return [null, ResponseStatus.Other, 'Other kind of error'];
} 

public getStack() {
  let stack = '';
  try {
    throw new Error();
  } catch(e) {
    stack = e.stack;
  }
  return stack;
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda