aws / aws/aws-lambda-dotnet

Support PowerShell ErrorActionPreference Continue

Offen
#1,093 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug module/custom-runtime p2 queued
Vorherrschende Sprache
C#
Sterne
1.7k
Forks
503
Ø Merge
1 T. 18 Std.
Gemergte PRs (30 T.)
21

Beschreibung

Describe the Feature

ErrorActionPreference Continue results in the last object being returned to the caller.

ErrorActionPreference should work as you would expect if you ran your script outside of lambda. If ErrorActionPreference is set to Continue, the script should continue to execute and return the last object, not the error.

Is your Feature Request related to a problem?

Module functions that write errors have to be suppressed using ErrorAction SilentlyContinue to prevent lambda from "giving up" on returning the last object.

Proposed Solution

Describe alternatives you've considered

Additional Context

The default ErrorActionPreference in lambda is Continue however lambda is weird and it will hold on to an error and give it to the caller rather than return the last object.

It does not "throw" or "return" the error (i.e. stop execution) as you would expect in reading the documentation. The script will continue to run regardless of the error. If a script has side effects that occur after the error (like Write-S3Object) they will run.

This can mislead developers into thinking their code stopped (since they got some error early on in the script), but in reality the script continued to execute after the error.

Environment
  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

In der Issue ist keine Datei und kein Test genannt. Beginne damit nachzuverfolgen, wie die Lambda-Laufzeit PowerShell-Fehler erfasst und den zurückgegebenen Wert bestimmt, und vergleiche dieses Verhalten anschließend mit ErrorActionPreference Continue außerhalb von Lambda. Erledigt ist es, wenn die Ausführung nach einem Fehler fortgesetzt wird und das letzte Objekt statt des Fehlers an den Aufrufer zurückgegeben wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
aws, csharp, powershell
Bereich
backend, cloud
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.